add plan/description status sub queries, add elastic status field, ui fixes

This commit is contained in:
CITE\amentis 2024-09-23 14:45:05 +03:00
parent e4567b8b75
commit 1c60bdf77b
57 changed files with 403 additions and 201 deletions

View File

@ -10,14 +10,14 @@ public class RecentActivityItemEntity {
private UUID id; private UUID id;
private Instant updatedAt; private Instant updatedAt;
private String label; private String label;
private Short statusValue; private UUID statusId;
public RecentActivityItemEntity(RecentActivityItemType type, UUID id, Instant updatedAt, String label, Short statusValue) { public RecentActivityItemEntity(RecentActivityItemType type, UUID id, Instant updatedAt, String label, UUID statusId) {
this.type = type; this.type = type;
this.id = id; this.id = id;
this.updatedAt = updatedAt; this.updatedAt = updatedAt;
this.label = label; this.label = label;
this.statusValue = statusValue; this.statusId = statusId;
} }
public RecentActivityItemType getType() { public RecentActivityItemType getType() {
@ -52,11 +52,11 @@ public class RecentActivityItemEntity {
this.label = label; this.label = label;
} }
public Short getStatusValue() { public UUID getStatusId() {
return statusValue; return statusId;
} }
public void setStatusValue(Short statusValue) { public void setStatusId(UUID statusId) {
this.statusValue = statusValue; this.statusId = statusId;
} }
} }

View File

@ -33,9 +33,9 @@ public class DescriptionElasticEntity {
private String description; private String description;
public final static String _description = "description"; public final static String _description = "description";
@Field(value = DescriptionElasticEntity._status, type = FieldType.Short) @Field(value = DescriptionElasticEntity._statusId, type = FieldType.Keyword)
private DescriptionStatus status; private UUID statusId;
public final static String _status = "status"; public final static String _statusId = "statusId";
@Field(value = DescriptionElasticEntity._finalizedAt, type = FieldType.Date) @Field(value = DescriptionElasticEntity._finalizedAt, type = FieldType.Date)
private Date finalizedAt; private Date finalizedAt;
@ -97,12 +97,12 @@ public class DescriptionElasticEntity {
this.description = description; this.description = description;
} }
public DescriptionStatus getStatus() { public UUID getStatusId() {
return this.status; return statusId;
} }
public void setStatus(DescriptionStatus status) { public void setStatusId(UUID statusId) {
this.status = status; this.statusId = statusId;
} }
public Date getFinalizedAt() { public Date getFinalizedAt() {

View File

@ -35,9 +35,9 @@ public class PlanElasticEntity {
private Short version; private Short version;
public final static String _version = "version"; public final static String _version = "version";
@Field(value = PlanElasticEntity._status, type = FieldType.Short) @Field(value = PlanElasticEntity._statusId, type = FieldType.Keyword)
private PlanStatus status; private UUID statusId;
public final static String _status = "status"; public final static String _statusId = "statusId";
@Field(value = PlanElasticEntity._accessType, type = FieldType.Short) @Field(value = PlanElasticEntity._accessType, type = FieldType.Short)
private PlanAccessType accessType; private PlanAccessType accessType;
@ -130,12 +130,12 @@ public class PlanElasticEntity {
this.version = version; this.version = version;
} }
public PlanStatus getStatus() { public UUID getStatusId() {
return this.status; return statusId;
} }
public void setStatus(PlanStatus status) { public void setStatusId(UUID statusId) {
this.status = status; this.statusId = statusId;
} }
public PlanAccessType getAccessType() { public PlanAccessType getAccessType() {

View File

@ -35,9 +35,9 @@ public class NestedPlanElasticEntity {
private PlanVersionStatus versionStatus; private PlanVersionStatus versionStatus;
public final static String _versionStatus = "versionStatus"; public final static String _versionStatus = "versionStatus";
@Field(value = NestedPlanElasticEntity._status, type = FieldType.Short) @Field(value = NestedPlanElasticEntity._statusId, type = FieldType.Keyword)
private PlanStatus status; private UUID statusId;
public final static String _status = "status"; public final static String _statusId = "statusId";
@Field(value = NestedPlanElasticEntity._accessType, type = FieldType.Short) @Field(value = NestedPlanElasticEntity._accessType, type = FieldType.Short)
private PlanAccessType accessType; private PlanAccessType accessType;
@ -103,12 +103,12 @@ public class NestedPlanElasticEntity {
this.version = version; this.version = version;
} }
public PlanStatus getStatus() { public UUID getStatusId() {
return status; return statusId;
} }
public void setStatus(PlanStatus status) { public void setStatusId(UUID statusId) {
this.status = status; this.statusId = statusId;
} }
public PlanAccessType getAccessType() { public PlanAccessType getAccessType() {

View File

@ -63,7 +63,7 @@ public class DescriptionElasticBuilder extends BaseElasticBuilder<DescriptionEla
m.setId(d.getId()); m.setId(d.getId());
m.setLabel(d.getLabel()); m.setLabel(d.getLabel());
m.setDescription(d.getDescription()); m.setDescription(d.getDescription());
m.setStatus(d.getStatus()); m.setStatusId(d.getStatusId());
m.setCreatedAt(Date.from(d.getCreatedAt())); m.setCreatedAt(Date.from(d.getCreatedAt()));
m.setUpdatedAt(Date.from(d.getUpdatedAt())); m.setUpdatedAt(Date.from(d.getUpdatedAt()));
if (d.getFinalizedAt() != null) { if (d.getFinalizedAt() != null) {

View File

@ -55,7 +55,7 @@ public class PlanElasticBuilder extends BaseElasticBuilder<PlanElasticEntity, Pl
m.setDescription(d.getDescription()); m.setDescription(d.getDescription());
m.setVersion(d.getVersion()); m.setVersion(d.getVersion());
m.setVersionStatus(d.getVersionStatus()); m.setVersionStatus(d.getVersionStatus());
m.setStatus(d.getStatus()); m.setStatusId(d.getStatusId());
m.setAccessType(d.getAccessType()); m.setAccessType(d.getAccessType());
m.setLanguage(d.getLanguage()); m.setLanguage(d.getLanguage());
m.setBlueprintId(d.getBlueprintId()); m.setBlueprintId(d.getBlueprintId());

View File

@ -60,7 +60,7 @@ public class NestedPlanElasticBuilder extends BaseElasticBuilder<NestedPlanElast
m.setLabel(d.getLabel()); m.setLabel(d.getLabel());
m.setDescription(d.getDescription()); m.setDescription(d.getDescription());
m.setVersion(d.getVersion()); m.setVersion(d.getVersion());
m.setStatus(d.getStatus()); m.setStatusId(d.getStatusId());
m.setAccessType(d.getAccessType()); m.setAccessType(d.getAccessType());
m.setLanguage(d.getLanguage()); m.setLanguage(d.getLanguage());
m.setBlueprintId(d.getBlueprintId()); m.setBlueprintId(d.getBlueprintId());

View File

@ -50,7 +50,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
private Instant finalizedBefore; private Instant finalizedBefore;
private Collection<UUID> excludedIds; private Collection<UUID> excludedIds;
private Collection<UUID> tenantIds; private Collection<UUID> tenantIds;
private Collection<DescriptionStatus> statuses; private Collection<UUID> statusIds;
private NestedDescriptionTemplateElasticQuery descriptionTemplateSubQuery; private NestedDescriptionTemplateElasticQuery descriptionTemplateSubQuery;
private NestedReferenceElasticQuery referenceSubQuery; private NestedReferenceElasticQuery referenceSubQuery;
private NestedTagElasticQuery tagSubQuery; private NestedTagElasticQuery tagSubQuery;
@ -133,18 +133,18 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
return this; return this;
} }
public DescriptionElasticQuery statuses(DescriptionStatus value) { public DescriptionElasticQuery statusIds(UUID value) {
this.statuses = List.of(value); this.statusIds = List.of(value);
return this; return this;
} }
public DescriptionElasticQuery statuses(DescriptionStatus... value) { public DescriptionElasticQuery statusIds(UUID... value) {
this.statuses = Arrays.asList(value); this.statusIds = Arrays.asList(value);
return this; return this;
} }
public DescriptionElasticQuery statuses(Collection<DescriptionStatus> values) { public DescriptionElasticQuery statusIds(Collection<UUID> values) {
this.statuses = values; this.statusIds = values;
return this; return this;
} }
@ -189,7 +189,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
protected Boolean isFalseQuery() { protected Boolean isFalseQuery() {
return this.isEmpty(this.ids) || return this.isEmpty(this.ids) ||
this.isEmpty(this.excludedIds) || this.isEmpty(this.excludedIds) ||
this.isEmpty(this.statuses); this.isEmpty(this.statusIds);
} }
@Override @Override
@ -230,7 +230,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
List<Query> predicates = new ArrayList<>(); List<Query> predicates = new ArrayList<>();
if (usePublic ) { if (usePublic ) {
predicates.add(this.and( predicates.add(this.and(
this.equals(new ElasticField(DescriptionElasticEntity._plan + "." + PlanElasticEntity._status, this.entityClass()).disableInfer(true), PlanStatus.Finalized.getValue()), this.equals(new ElasticField(DescriptionElasticEntity._plan + "." + PlanElasticEntity._statusId, this.entityClass()).disableInfer(true), PlanStatus.Finalized.getValue()),
this.equals(new ElasticField(DescriptionElasticEntity._plan + "." + PlanElasticEntity._accessType, this.entityClass()).disableInfer(true), PlanAccessType.Public.getValue()) this.equals(new ElasticField(DescriptionElasticEntity._plan + "." + PlanElasticEntity._accessType, this.entityClass()).disableInfer(true), PlanAccessType.Public.getValue())
)); ));
} }
@ -284,8 +284,8 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
if (this.tenantIds != null) { if (this.tenantIds != null) {
predicates.add(this.containsUUID(this.elasticFieldOf(DescriptionElasticEntity._tenantId), this.tenantIds)._toQuery()); predicates.add(this.containsUUID(this.elasticFieldOf(DescriptionElasticEntity._tenantId), this.tenantIds)._toQuery());
} }
if (this.statuses != null) { if (this.statusIds != null) {
predicates.add(this.contains(this.elasticFieldOf(DescriptionElasticEntity._status), this.statuses.stream().map(DescriptionStatus::getValue).toList().toArray(new Short[this.statuses.size()]))._toQuery()); predicates.add(this.containsUUID(this.elasticFieldOf(DescriptionElasticEntity._statusId), this.statusIds)._toQuery());
} }
if (this.finalizedAfter != null) { if (this.finalizedAfter != null) {
predicates.add(this.dateGreaterThanQuery(this.elasticFieldOf(DescriptionElasticEntity._finalizedAt), this.finalizedAfter)._toQuery()); predicates.add(this.dateGreaterThanQuery(this.elasticFieldOf(DescriptionElasticEntity._finalizedAt), this.finalizedAfter)._toQuery());
@ -324,7 +324,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
if (columns.contains(DescriptionElasticEntity._id)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._id), UUID.class)); if (columns.contains(DescriptionElasticEntity._id)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._id), UUID.class));
if (columns.contains(DescriptionElasticEntity._label)) mocDoc.setLabel(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._label), String.class)); if (columns.contains(DescriptionElasticEntity._label)) mocDoc.setLabel(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._label), String.class));
if (columns.contains(DescriptionElasticEntity._description)) mocDoc.setDescription(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._description), String.class)); if (columns.contains(DescriptionElasticEntity._description)) mocDoc.setDescription(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._description), String.class));
if (columns.contains(DescriptionElasticEntity._status)) mocDoc.setStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._status), DescriptionStatus.class)); if (columns.contains(DescriptionElasticEntity._statusId)) mocDoc.setStatusId(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._statusId), UUID.class));
if (columns.contains(DescriptionElasticEntity._finalizedAt)) mocDoc.setFinalizedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._finalizedAt), Date.class)); if (columns.contains(DescriptionElasticEntity._finalizedAt)) mocDoc.setFinalizedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._finalizedAt), Date.class));
if (columns.contains(DescriptionElasticEntity._createdAt)) mocDoc.setCreatedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._createdAt), Date.class)); if (columns.contains(DescriptionElasticEntity._createdAt)) mocDoc.setCreatedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._createdAt), Date.class));
if (columns.contains(DescriptionElasticEntity._updatedAt)) mocDoc.setUpdatedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._updatedAt), Date.class)); if (columns.contains(DescriptionElasticEntity._updatedAt)) mocDoc.setUpdatedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DescriptionElasticEntity._updatedAt), Date.class));
@ -340,7 +340,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
if (item.match(DescriptionElasticEntity._id)) return this.elasticFieldOf(DescriptionElasticEntity._id); if (item.match(DescriptionElasticEntity._id)) return this.elasticFieldOf(DescriptionElasticEntity._id);
else if (item.match(DescriptionElasticEntity._label)) return item instanceof OrderingFieldResolver ? this.elasticFieldOf(DescriptionElasticEntity._label).subfield(ElasticConstants.SubFields.keyword) : this.elasticFieldOf(DescriptionElasticEntity._label); else if (item.match(DescriptionElasticEntity._label)) return item instanceof OrderingFieldResolver ? this.elasticFieldOf(DescriptionElasticEntity._label).subfield(ElasticConstants.SubFields.keyword) : this.elasticFieldOf(DescriptionElasticEntity._label);
else if (item.match(DescriptionElasticEntity._description)) return this.elasticFieldOf(DescriptionElasticEntity._description); else if (item.match(DescriptionElasticEntity._description)) return this.elasticFieldOf(DescriptionElasticEntity._description);
else if (item.match(DescriptionElasticEntity._status)) return this.elasticFieldOf(DescriptionElasticEntity._status); else if (item.match(DescriptionElasticEntity._statusId)) return this.elasticFieldOf(DescriptionElasticEntity._statusId);
else if (item.match(DescriptionElasticEntity._finalizedAt)) return this.elasticFieldOf(DescriptionElasticEntity._finalizedAt); else if (item.match(DescriptionElasticEntity._finalizedAt)) return this.elasticFieldOf(DescriptionElasticEntity._finalizedAt);
else if (item.match(DescriptionElasticEntity._createdAt)) return this.elasticFieldOf(DescriptionElasticEntity._createdAt); else if (item.match(DescriptionElasticEntity._createdAt)) return this.elasticFieldOf(DescriptionElasticEntity._createdAt);
else if (item.match(DescriptionElasticEntity._updatedAt)) return this.elasticFieldOf(DescriptionElasticEntity._updatedAt); else if (item.match(DescriptionElasticEntity._updatedAt)) return this.elasticFieldOf(DescriptionElasticEntity._updatedAt);

View File

@ -30,7 +30,7 @@ public class InnerObjectPlanElasticQuery extends ElasticInnerObjectQuery<InnerOb
private String like; private String like;
private Collection<UUID> ids; private Collection<UUID> ids;
private Collection<UUID> excludedIds; private Collection<UUID> excludedIds;
private Collection<PlanStatus> statuses; private Collection<UUID> statusIds;
private Collection<PlanVersionStatus> versionStatuses; private Collection<PlanVersionStatus> versionStatuses;
private Collection<PlanAccessType> accessTypes; private Collection<PlanAccessType> accessTypes;
private Collection<Integer> versions; private Collection<Integer> versions;
@ -108,18 +108,18 @@ public class InnerObjectPlanElasticQuery extends ElasticInnerObjectQuery<InnerOb
return this; return this;
} }
public InnerObjectPlanElasticQuery statuses(PlanStatus value) { public InnerObjectPlanElasticQuery statusIds(UUID value) {
this.statuses = List.of(value); this.statusIds = List.of(value);
return this; return this;
} }
public InnerObjectPlanElasticQuery statuses(PlanStatus... value) { public InnerObjectPlanElasticQuery statusIds(UUID... value) {
this.statuses = Arrays.asList(value); this.statusIds = Arrays.asList(value);
return this; return this;
} }
public InnerObjectPlanElasticQuery statuses(Collection<PlanStatus> values) { public InnerObjectPlanElasticQuery statusIds(Collection<UUID> values) {
this.statuses = values; this.statusIds = values;
return this; return this;
} }
@ -203,8 +203,8 @@ public class InnerObjectPlanElasticQuery extends ElasticInnerObjectQuery<InnerOb
if (this.excludedIds != null) { if (this.excludedIds != null) {
predicates.add(this.not(this.containsUUID(this.elasticFieldOf(NestedPlanElasticEntity._id).disableInfer(true), this.excludedIds)._toQuery())._toQuery()); predicates.add(this.not(this.containsUUID(this.elasticFieldOf(NestedPlanElasticEntity._id).disableInfer(true), this.excludedIds)._toQuery())._toQuery());
} }
if (this.statuses != null) { if (this.statusIds != null) {
predicates.add(this.contains(this.elasticFieldOf(NestedPlanElasticEntity._status).disableInfer(true), this.statuses.stream().map(x-> x.getValue()).collect(Collectors.toList()).toArray(new Short[this.statuses.size()]))._toQuery()); predicates.add(this.containsUUID(this.elasticFieldOf(NestedPlanElasticEntity._id).disableInfer(true), this.statusIds)._toQuery());
} }
if (this.versionStatuses != null) { if (this.versionStatuses != null) {
predicates.add(this.contains(this.elasticFieldOf(NestedPlanElasticEntity._versionStatus).disableInfer(true), this.versionStatuses.stream().map(x-> x.getValue()).collect(Collectors.toList()).toArray(new Short[this.versionStatuses.size()]))._toQuery()); predicates.add(this.contains(this.elasticFieldOf(NestedPlanElasticEntity._versionStatus).disableInfer(true), this.versionStatuses.stream().map(x-> x.getValue()).collect(Collectors.toList()).toArray(new Short[this.versionStatuses.size()]))._toQuery());
@ -229,7 +229,7 @@ public class InnerObjectPlanElasticQuery extends ElasticInnerObjectQuery<InnerOb
if (columns.contains(NestedPlanElasticEntity._id)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._id), UUID.class)); if (columns.contains(NestedPlanElasticEntity._id)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._id), UUID.class));
if (columns.contains(NestedPlanElasticEntity._label)) mocDoc.setLabel(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._label), String.class)); if (columns.contains(NestedPlanElasticEntity._label)) mocDoc.setLabel(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._label), String.class));
if (columns.contains(NestedPlanElasticEntity._description)) mocDoc.setDescription(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._description), String.class)); if (columns.contains(NestedPlanElasticEntity._description)) mocDoc.setDescription(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._description), String.class));
if (columns.contains(NestedPlanElasticEntity._status)) mocDoc.setStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._status), PlanStatus.class)); if (columns.contains(NestedPlanElasticEntity._statusId)) mocDoc.setStatusId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._statusId), UUID.class));
if (columns.contains(NestedPlanElasticEntity._versionStatus)) mocDoc.setVersionStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._versionStatus), PlanVersionStatus.class)); if (columns.contains(NestedPlanElasticEntity._versionStatus)) mocDoc.setVersionStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._versionStatus), PlanVersionStatus.class));
if (columns.contains(NestedPlanElasticEntity._version)) mocDoc.setVersion(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._version), Short.class)); if (columns.contains(NestedPlanElasticEntity._version)) mocDoc.setVersion(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._version), Short.class));
if (columns.contains(NestedPlanElasticEntity._groupId)) mocDoc.setGroupId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._groupId), UUID.class)); if (columns.contains(NestedPlanElasticEntity._groupId)) mocDoc.setGroupId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._groupId), UUID.class));
@ -245,7 +245,7 @@ public class InnerObjectPlanElasticQuery extends ElasticInnerObjectQuery<InnerOb
if (item.match(NestedPlanElasticEntity._id)) return this.elasticFieldOf(NestedPlanElasticEntity._id); if (item.match(NestedPlanElasticEntity._id)) return this.elasticFieldOf(NestedPlanElasticEntity._id);
else if (item.match(NestedPlanElasticEntity._label)) return this.elasticFieldOf(NestedPlanElasticEntity._label); else if (item.match(NestedPlanElasticEntity._label)) return this.elasticFieldOf(NestedPlanElasticEntity._label);
else if (item.match(NestedPlanElasticEntity._description)) return this.elasticFieldOf(NestedPlanElasticEntity._description); else if (item.match(NestedPlanElasticEntity._description)) return this.elasticFieldOf(NestedPlanElasticEntity._description);
else if (item.match(NestedPlanElasticEntity._status)) return this.elasticFieldOf(NestedPlanElasticEntity._status); else if (item.match(NestedPlanElasticEntity._statusId)) return this.elasticFieldOf(NestedPlanElasticEntity._statusId);
else if (item.match(NestedPlanElasticEntity._versionStatus)) return this.elasticFieldOf(NestedPlanElasticEntity._versionStatus); else if (item.match(NestedPlanElasticEntity._versionStatus)) return this.elasticFieldOf(NestedPlanElasticEntity._versionStatus);
else if (item.match(NestedPlanElasticEntity._version)) return this.elasticFieldOf(NestedPlanElasticEntity._version); else if (item.match(NestedPlanElasticEntity._version)) return this.elasticFieldOf(NestedPlanElasticEntity._version);
else if (item.match(NestedPlanElasticEntity._groupId)) return this.elasticFieldOf(NestedPlanElasticEntity._groupId); else if (item.match(NestedPlanElasticEntity._groupId)) return this.elasticFieldOf(NestedPlanElasticEntity._groupId);

View File

@ -42,7 +42,7 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
private String like; private String like;
private Collection<UUID> ids; private Collection<UUID> ids;
private Collection<UUID> excludedIds; private Collection<UUID> excludedIds;
private Collection<PlanStatus> statuses; private Collection<UUID> statusIds;
private Collection<PlanVersionStatus> versionStatuses; private Collection<PlanVersionStatus> versionStatuses;
private Collection<PlanAccessType> accessTypes; private Collection<PlanAccessType> accessTypes;
private Collection<Integer> versions; private Collection<Integer> versions;
@ -140,18 +140,18 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
return this; return this;
} }
public PlanElasticQuery statuses(PlanStatus value) { public PlanElasticQuery statuses(UUID value) {
this.statuses = List.of(value); this.statusIds = List.of(value);
return this; return this;
} }
public PlanElasticQuery statuses(PlanStatus... value) { public PlanElasticQuery statuses(UUID... value) {
this.statuses = Arrays.asList(value); this.statusIds = Arrays.asList(value);
return this; return this;
} }
public PlanElasticQuery statuses(Collection<PlanStatus> values) { public PlanElasticQuery statuses(Collection<UUID> values) {
this.statuses = values; this.statusIds = values;
return this; return this;
} }
@ -224,7 +224,7 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
@Override @Override
protected Boolean isFalseQuery() { protected Boolean isFalseQuery() {
return this.isEmpty(this.ids) || this.isEmpty(this.versionStatuses) || this.isEmpty(this.excludedIds) || this.isEmpty(this.accessTypes)|| this.isEmpty(this.statuses); return this.isEmpty(this.ids) || this.isEmpty(this.versionStatuses) || this.isEmpty(this.excludedIds) || this.isEmpty(this.accessTypes)|| this.isEmpty(this.statusIds);
} }
@Override @Override
@ -265,7 +265,7 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
List<Query> predicates = new ArrayList<>(); List<Query> predicates = new ArrayList<>();
if (usePublic) { if (usePublic) {
predicates.add(this.and( predicates.add(this.and(
this.equals(this.elasticFieldOf(PlanElasticEntity._status), PlanStatus.Finalized.getValue()), this.equals(this.elasticFieldOf(PlanElasticEntity._statusId), PlanStatus.Finalized.getValue()),
this.equals(this.elasticFieldOf(PlanElasticEntity._accessType), PlanAccessType.Public.getValue()) this.equals(this.elasticFieldOf(PlanElasticEntity._accessType), PlanAccessType.Public.getValue())
)); ));
} }
@ -328,8 +328,8 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
if (this.excludedIds != null) { if (this.excludedIds != null) {
predicates.add(this.not(this.containsUUID(this.elasticFieldOf(PlanElasticEntity._id), this.excludedIds)._toQuery())._toQuery()); predicates.add(this.not(this.containsUUID(this.elasticFieldOf(PlanElasticEntity._id), this.excludedIds)._toQuery())._toQuery());
} }
if (this.statuses != null) { if (this.statusIds != null) {
predicates.add(this.contains(this.elasticFieldOf(PlanElasticEntity._status), this.statuses.stream().map(PlanStatus::getValue).toList().toArray(new Short[this.statuses.size()]))._toQuery()); predicates.add(this.containsUUID(this.elasticFieldOf(PlanElasticEntity._statusId), this.statusIds)._toQuery());
} }
if (this.versionStatuses != null) { if (this.versionStatuses != null) {
predicates.add(this.contains(this.elasticFieldOf(PlanElasticEntity._versionStatus), this.versionStatuses.stream().map(PlanVersionStatus::getValue).toList().toArray(new Short[this.versionStatuses.size()]))._toQuery()); predicates.add(this.contains(this.elasticFieldOf(PlanElasticEntity._versionStatus), this.versionStatuses.stream().map(PlanVersionStatus::getValue).toList().toArray(new Short[this.versionStatuses.size()]))._toQuery());
@ -363,7 +363,7 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
if (columns.contains(PlanElasticEntity._id)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._id), UUID.class)); if (columns.contains(PlanElasticEntity._id)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._id), UUID.class));
if (columns.contains(PlanElasticEntity._label)) mocDoc.setLabel(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._label), String.class)); if (columns.contains(PlanElasticEntity._label)) mocDoc.setLabel(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._label), String.class));
if (columns.contains(PlanElasticEntity._description)) mocDoc.setDescription(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._description), String.class)); if (columns.contains(PlanElasticEntity._description)) mocDoc.setDescription(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._description), String.class));
if (columns.contains(PlanElasticEntity._status)) mocDoc.setStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._status), PlanStatus.class)); if (columns.contains(PlanElasticEntity._statusId)) mocDoc.setStatusId(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._statusId), UUID.class));
if (columns.contains(PlanElasticEntity._versionStatus)) mocDoc.setVersionStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._versionStatus), PlanVersionStatus.class)); if (columns.contains(PlanElasticEntity._versionStatus)) mocDoc.setVersionStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._versionStatus), PlanVersionStatus.class));
if (columns.contains(PlanElasticEntity._version)) mocDoc.setVersion(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._version), Short.class)); if (columns.contains(PlanElasticEntity._version)) mocDoc.setVersion(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._version), Short.class));
if (columns.contains(PlanElasticEntity._groupId)) mocDoc.setGroupId(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._groupId), UUID.class)); if (columns.contains(PlanElasticEntity._groupId)) mocDoc.setGroupId(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._groupId), UUID.class));
@ -383,7 +383,7 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
if (item.match(PlanElasticEntity._id)) return this.elasticFieldOf(PlanElasticEntity._id); if (item.match(PlanElasticEntity._id)) return this.elasticFieldOf(PlanElasticEntity._id);
else if (item.match(PlanElasticEntity._label)) return item instanceof OrderingFieldResolver ? this.elasticFieldOf(PlanElasticEntity._label).subfield(ElasticConstants.SubFields.keyword) : this.elasticFieldOf(PlanElasticEntity._label); else if (item.match(PlanElasticEntity._label)) return item instanceof OrderingFieldResolver ? this.elasticFieldOf(PlanElasticEntity._label).subfield(ElasticConstants.SubFields.keyword) : this.elasticFieldOf(PlanElasticEntity._label);
else if (item.match(PlanElasticEntity._description)) return this.elasticFieldOf(PlanElasticEntity._description); else if (item.match(PlanElasticEntity._description)) return this.elasticFieldOf(PlanElasticEntity._description);
else if (item.match(PlanElasticEntity._status)) return this.elasticFieldOf(PlanElasticEntity._status); else if (item.match(PlanElasticEntity._statusId)) return this.elasticFieldOf(PlanElasticEntity._statusId);
else if (item.match(PlanElasticEntity._version)) return this.elasticFieldOf(PlanElasticEntity._version); else if (item.match(PlanElasticEntity._version)) return this.elasticFieldOf(PlanElasticEntity._version);
else if (item.match(PlanElasticEntity._versionStatus)) return this.elasticFieldOf(PlanElasticEntity._versionStatus); else if (item.match(PlanElasticEntity._versionStatus)) return this.elasticFieldOf(PlanElasticEntity._versionStatus);
else if (item.match(PlanElasticEntity._groupId)) return this.elasticFieldOf(PlanElasticEntity._groupId); else if (item.match(PlanElasticEntity._groupId)) return this.elasticFieldOf(PlanElasticEntity._groupId);

View File

@ -6,9 +6,7 @@ import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.commons.enums.RecentActivityOrder; import org.opencdmp.commons.enums.RecentActivityOrder;
import org.opencdmp.model.description.Description; import org.opencdmp.model.description.Description;
import org.opencdmp.model.plan.Plan; import org.opencdmp.model.plan.Plan;
import org.opencdmp.query.lookup.DescriptionLookup; import org.opencdmp.query.lookup.*;
import org.opencdmp.query.lookup.PlanLookup;
import org.opencdmp.query.lookup.PlanUserLookup;
import gr.cite.tools.data.query.Ordering; import gr.cite.tools.data.query.Ordering;
import gr.cite.tools.data.query.Paging; import gr.cite.tools.data.query.Paging;
import gr.cite.tools.fieldset.BaseFieldSet; import gr.cite.tools.fieldset.BaseFieldSet;
@ -97,8 +95,12 @@ public class RecentActivityItemLookup{
DescriptionLookup lookup = new DescriptionLookup(); DescriptionLookup lookup = new DescriptionLookup();
lookup.setIsActive(List.of(IsActive.Active)); lookup.setIsActive(List.of(IsActive.Active));
if (this.like != null) lookup.setLike(this.like); if (this.like != null) lookup.setLike(this.like);
if (this.onlyDraft != null) lookup.setStatuses(List.of(DescriptionStatus.Draft)); if (this.onlyDraft != null) {
else lookup.setStatuses(List.of(DescriptionStatus.Draft, DescriptionStatus.Finalized)); DescriptionStatusLookup descriptionStatusLookup = new DescriptionStatusLookup();
descriptionStatusLookup.setInternalStatuses(List.of(DescriptionStatus.Draft));
descriptionStatusLookup.setIsActive(List.of(IsActive.Active));
lookup.setDescriptionStatusSubQuery(descriptionStatusLookup);
}
if (this.userIds != null) { if (this.userIds != null) {
PlanLookup planLookup = new PlanLookup(); PlanLookup planLookup = new PlanLookup();
PlanUserLookup planUserLookup = new PlanUserLookup(); PlanUserLookup planUserLookup = new PlanUserLookup();
@ -131,7 +133,12 @@ public class RecentActivityItemLookup{
PlanLookup lookup = new PlanLookup(); PlanLookup lookup = new PlanLookup();
lookup.setIsActive(List.of(IsActive.Active)); lookup.setIsActive(List.of(IsActive.Active));
if (this.like != null) lookup.setLike(this.like); if (this.like != null) lookup.setLike(this.like);
if (this.onlyDraft != null) lookup.setStatuses(List.of(PlanStatus.Draft)); if (this.onlyDraft != null) {
PlanStatusLookup planStatusLookup = new PlanStatusLookup();
planStatusLookup.setInternalStatuses(List.of(PlanStatus.Draft));
planStatusLookup.setIsActive(List.of(IsActive.Active));
lookup.setPlanStatusSubQuery(planStatusLookup);
}
if (this.userIds != null) { if (this.userIds != null) {
PlanUserLookup planUserLookup = new PlanUserLookup(); PlanUserLookup planUserLookup = new PlanUserLookup();
planUserLookup.setUserIds(this.userIds); planUserLookup.setUserIds(this.userIds);

View File

@ -28,6 +28,7 @@ import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
import org.opencdmp.query.DescriptionTemplateQuery; import org.opencdmp.query.DescriptionTemplateQuery;
import org.opencdmp.query.PlanDescriptionTemplateQuery; import org.opencdmp.query.PlanDescriptionTemplateQuery;
import org.opencdmp.query.PlanQuery; import org.opencdmp.query.PlanQuery;
import org.opencdmp.query.PlanStatusQuery;
import org.opencdmp.service.visibility.VisibilityService; import org.opencdmp.service.visibility.VisibilityService;
import org.opencdmp.service.visibility.VisibilityServiceImpl; import org.opencdmp.service.visibility.VisibilityServiceImpl;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -197,7 +198,8 @@ public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder<Descri
if (this.isPublic) { if (this.isPublic) {
try { try {
this.entityManager.disableTenantFilters(); this.entityManager.disableTenantFilters();
q = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(data.stream().map(DescriptionEntity::getPlanId).distinct().collect(Collectors.toList())).isActive(IsActive.Active).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
q = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(data.stream().map(DescriptionEntity::getPlanId).distinct().collect(Collectors.toList())).isActive(IsActive.Active).planStatusSubQuery(statusQuery).accessTypes(PlanAccessType.Public);
itemMap = this.builderFactory.builder(PlanCommonModelBuilder.class).setRepositoryId(this.repositoryId).useSharedStorage(this.useSharedStorage).setDisableDescriptions(true).authorize(this.authorize).asForeignKey(q, PlanEntity::getId); itemMap = this.builderFactory.builder(PlanCommonModelBuilder.class).setRepositoryId(this.repositoryId).useSharedStorage(this.useSharedStorage).setDisableDescriptions(true).authorize(this.authorize).asForeignKey(q, PlanEntity::getId);
try { try {
this.entityManager.reloadTenantFilters(); this.entityManager.reloadTenantFilters();

View File

@ -219,7 +219,8 @@ public class PlanCommonModelBuilder extends BaseCommonModelBuilder<PlanModel, Pl
if (this.isPublic) { if (this.isPublic) {
try { try {
this.entityManager.disableTenantFilters(); this.entityManager.disableTenantFilters();
query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())).planSubQuery(this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).statuses(org.opencdmp.commons.enums.PlanStatus.Finalized).accessTypes(org.opencdmp.commons.enums.PlanAccessType.Public)); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(org.opencdmp.commons.enums.PlanStatus.Finalized).isActives(IsActive.Active);
query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())).planSubQuery(this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).planStatusSubQuery(statusQuery).accessTypes(org.opencdmp.commons.enums.PlanAccessType.Public));
itemMap = this.builderFactory.builder(DescriptionCommonModelBuilder.class).setRepositoryId(this.repositoryId).useSharedStorage(this.useSharedStorage).isPublic(this.isPublic).authorize(this.authorize).asMasterKey(query, DescriptionEntity::getPlanId); itemMap = this.builderFactory.builder(DescriptionCommonModelBuilder.class).setRepositoryId(this.repositoryId).useSharedStorage(this.useSharedStorage).isPublic(this.isPublic).authorize(this.authorize).asMasterKey(query, DescriptionEntity::getPlanId);
try { try {
this.entityManager.reloadTenantFilters(); this.entityManager.reloadTenantFilters();

View File

@ -58,7 +58,7 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
private Collection<IsActive> isActives; private Collection<IsActive> isActives;
private Collection<DescriptionStatus> statuses; private Collection<UUID> statusIds;
private Collection<UUID> planIds; private Collection<UUID> planIds;
@ -72,6 +72,8 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
private Collection<UUID> planDescriptionTemplateIds; private Collection<UUID> planDescriptionTemplateIds;
private DescriptionStatusQuery descriptionStatusQuery;
private final TenantEntityManager tenantEntityManager; private final TenantEntityManager tenantEntityManager;
public DescriptionQuery(UserScope userScope, AuthorizationService authService, QueryUtilsService queryUtilsService, TenantEntityManager tenantEntityManager) { public DescriptionQuery(UserScope userScope, AuthorizationService authService, QueryUtilsService queryUtilsService, TenantEntityManager tenantEntityManager) {
this.userScope = userScope; this.userScope = userScope;
@ -210,18 +212,18 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
return this; return this;
} }
public DescriptionQuery statuses(DescriptionStatus value) { public DescriptionQuery statusIds(UUID value) {
this.statuses = List.of(value); this.statusIds = List.of(value);
return this; return this;
} }
public DescriptionQuery statuses(DescriptionStatus... value) { public DescriptionQuery statusIds(UUID... value) {
this.statuses = Arrays.asList(value); this.statusIds = Arrays.asList(value);
return this; return this;
} }
public DescriptionQuery statuses(Collection<DescriptionStatus> values) { public DescriptionQuery statusIds(Collection<UUID> values) {
this.statuses = values; this.statusIds = values;
return this; return this;
} }
@ -250,6 +252,11 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
return this; return this;
} }
public DescriptionQuery descriptionStatusSubQuery(DescriptionStatusQuery subQuery) {
this.descriptionStatusQuery = subQuery;
return this;
}
@Override @Override
protected EntityManager entityManager(){ protected EntityManager entityManager(){
return this.tenantEntityManager.getEntityManager(); return this.tenantEntityManager.getEntityManager();
@ -261,7 +268,7 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
this.isEmpty(this.ids) || this.isEmpty(this.ids) ||
this.isEmpty(this.isActives) || this.isEmpty(this.createdByIds) || this.isEmpty(this.isActives) || this.isEmpty(this.createdByIds) ||
this.isEmpty(this.excludedIds) || this.isFalseQuery(this.planQuery) || this.isEmpty(this.excludedIds) || this.isFalseQuery(this.planQuery) ||
this.isEmpty(this.statuses) || this.isFalseQuery(this.planDescriptionTemplateQuery); this.isEmpty(this.statusIds) || this.isFalseQuery(this.planDescriptionTemplateQuery);
} }
@Override @Override
@ -349,9 +356,9 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
inClause.value(item); inClause.value(item);
predicates.add(inClause); predicates.add(inClause);
} }
if (this.statuses != null) { if (this.statusIds != null) {
CriteriaBuilder.In<DescriptionStatus> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._status)); CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._statusId));
for (DescriptionStatus item : this.statuses) for (UUID item : this.statusIds)
inClause.value(item); inClause.value(item);
predicates.add(inClause); predicates.add(inClause);
} }
@ -381,6 +388,10 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
inClause.value(item); inClause.value(item);
predicates.add(inClause); predicates.add(inClause);
} }
if (this.descriptionStatusQuery != null) {
QueryContext<DescriptionStatusEntity, UUID> subQuery = this.applySubQuery(this.descriptionStatusQuery, queryContext, UUID.class, descriptionStatusEntityRoot -> descriptionStatusEntityRoot.get(DescriptionStatusEntity._id));
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._statusId)).value(subQuery.Query));
}
if (!predicates.isEmpty()) { if (!predicates.isEmpty()) {
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]); Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);

View File

@ -39,7 +39,7 @@ public class PlanQuery extends QueryBase<PlanEntity> {
private Collection<IsActive> isActives; private Collection<IsActive> isActives;
private Collection<PlanStatus> statuses; private Collection<UUID> statusIds;
private Collection<PlanVersionStatus> versionStatuses; private Collection<PlanVersionStatus> versionStatuses;
@ -61,6 +61,8 @@ public class PlanQuery extends QueryBase<PlanEntity> {
private EntityDoiQuery entityDoiQuery; private EntityDoiQuery entityDoiQuery;
private PlanStatusQuery planStatusQuery;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None); private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
private final UserScope userScope; private final UserScope userScope;
@ -177,18 +179,18 @@ public class PlanQuery extends QueryBase<PlanEntity> {
return this; return this;
} }
public PlanQuery statuses(PlanStatus value) { public PlanQuery statusIds(UUID value) {
this.statuses = List.of(value); this.statusIds = List.of(value);
return this; return this;
} }
public PlanQuery statuses(PlanStatus... value) { public PlanQuery statusIds(UUID... value) {
this.statuses = Arrays.asList(value); this.statusIds = Arrays.asList(value);
return this; return this;
} }
public PlanQuery statuses(Collection<PlanStatus> values) { public PlanQuery statusIds(Collection<UUID> values) {
this.statuses = values; this.statusIds = values;
return this; return this;
} }
@ -253,6 +255,11 @@ public class PlanQuery extends QueryBase<PlanEntity> {
return this; return this;
} }
public PlanQuery planStatusSubQuery(PlanStatusQuery subQuery) {
this.planStatusQuery = subQuery;
return this;
}
public PlanQuery authorize(EnumSet<AuthorizationFlags> values) { public PlanQuery authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values; this.authorize = values;
return this; return this;
@ -275,7 +282,7 @@ public class PlanQuery extends QueryBase<PlanEntity> {
@Override @Override
protected Boolean isFalseQuery() { protected Boolean isFalseQuery() {
return this.isEmpty(this.ids) || this.isEmpty(this.creatorIds) || this.isEmpty(this.isActives) || this.isEmpty(this.versionStatuses) || this.isEmpty(this.excludedIds) || this.isEmpty(this.accessTypes) || this.isEmpty(this.statuses) || this.isFalseQuery(this.planDescriptionTemplateQuery) || this.isFalseQuery(this.planUserQuery); return this.isEmpty(this.ids) || this.isEmpty(this.creatorIds) || this.isEmpty(this.isActives) || this.isEmpty(this.versionStatuses) || this.isEmpty(this.excludedIds) || this.isEmpty(this.accessTypes) || this.isEmpty(this.statusIds) || this.isFalseQuery(this.planDescriptionTemplateQuery) || this.isFalseQuery(this.planUserQuery);
} }
@Override @Override
@ -347,9 +354,9 @@ public class PlanQuery extends QueryBase<PlanEntity> {
inClause.value(item); inClause.value(item);
predicates.add(inClause); predicates.add(inClause);
} }
if (this.statuses != null) { if (this.statusIds != null) {
CriteriaBuilder.In<PlanStatus> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._status)); CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._statusId));
for (PlanStatus item : this.statuses) for (UUID item : this.statusIds)
inClause.value(item); inClause.value(item);
predicates.add(inClause); predicates.add(inClause);
} }
@ -407,6 +414,11 @@ public class PlanQuery extends QueryBase<PlanEntity> {
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._id)).value(subQuery.Query)); predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._id)).value(subQuery.Query));
} }
if (this.planStatusQuery != null) {
QueryContext<PlanStatusEntity, UUID> subQuery = this.applySubQuery(this.planStatusQuery, queryContext, UUID.class, planStatusEntityRoot -> planStatusEntityRoot.get(PlanStatusEntity._id));
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._statusId)).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);

View File

@ -3,7 +3,6 @@ package org.opencdmp.query.lookup;
import gr.cite.tools.data.query.Lookup; import gr.cite.tools.data.query.Lookup;
import gr.cite.tools.data.query.QueryFactory; import gr.cite.tools.data.query.QueryFactory;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.opencdmp.commons.enums.DescriptionStatus;
import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.elastic.query.DescriptionElasticQuery; import org.opencdmp.elastic.query.DescriptionElasticQuery;
import org.opencdmp.query.DescriptionQuery; import org.opencdmp.query.DescriptionQuery;
@ -31,7 +30,8 @@ public class DescriptionLookup extends Lookup {
private List<IsActive> isActive; private List<IsActive> isActive;
private List<DescriptionStatus> statuses; private List<UUID> statusIds;
private DescriptionStatusLookup descriptionStatusSubQuery;
public String getLike() { public String getLike() {
return this.like; return this.like;
@ -65,12 +65,12 @@ public class DescriptionLookup extends Lookup {
this.isActive = isActive; this.isActive = isActive;
} }
public List<DescriptionStatus> getStatuses() { public List<UUID> getStatusIds() {
return this.statuses; return statusIds;
} }
public void setStatuses(List<DescriptionStatus> statuses) { public void setStatusIds(List<UUID> statusIds) {
this.statuses = statuses; this.statusIds = statusIds;
} }
public PlanLookup getPlanSubQuery() { public PlanLookup getPlanSubQuery() {
@ -127,6 +127,14 @@ public class DescriptionLookup extends Lookup {
this.finalizedBefore = finalizedBefore; this.finalizedBefore = finalizedBefore;
} }
public DescriptionStatusLookup getDescriptionStatusSubQuery() {
return descriptionStatusSubQuery;
}
public void setDescriptionStatusSubQuery(DescriptionStatusLookup descriptionStatusSubQuery) {
this.descriptionStatusSubQuery = descriptionStatusSubQuery;
}
public DescriptionQuery enrich(QueryFactory queryFactory) { public DescriptionQuery enrich(QueryFactory queryFactory) {
DescriptionQuery query = queryFactory.query(DescriptionQuery.class); DescriptionQuery query = queryFactory.query(DescriptionQuery.class);
if (this.like != null) query.like(this.like); if (this.like != null) query.like(this.like);
@ -138,11 +146,12 @@ public class DescriptionLookup extends Lookup {
if (this.descriptionReferenceSubQuery != null) query.descriptionReferenceSubQuery(this.descriptionReferenceSubQuery.enrich(queryFactory)); if (this.descriptionReferenceSubQuery != null) query.descriptionReferenceSubQuery(this.descriptionReferenceSubQuery.enrich(queryFactory));
if (this.descriptionTagSubQuery != null) query.descriptionTagSubQuery(this.descriptionTagSubQuery.enrich(queryFactory)); if (this.descriptionTagSubQuery != null) query.descriptionTagSubQuery(this.descriptionTagSubQuery.enrich(queryFactory));
if (this.isActive != null) query.isActive(this.isActive); if (this.isActive != null) query.isActive(this.isActive);
if (this.statuses != null) query.statuses(this.statuses); if (this.statusIds != null) query.statusIds(this.statusIds);
if (this.createdAfter != null) query.createdAfter(this.createdAfter); if (this.createdAfter != null) query.createdAfter(this.createdAfter);
if (this.createdBefore != null) query.createdBefore(this.createdBefore); if (this.createdBefore != null) query.createdBefore(this.createdBefore);
if (this.finalizedAfter != null) query.finalizedAfter(this.finalizedAfter); if (this.finalizedAfter != null) query.finalizedAfter(this.finalizedAfter);
if (this.finalizedBefore != null) query.finalizedBefore(this.finalizedBefore); if (this.finalizedBefore != null) query.finalizedBefore(this.finalizedBefore);
if (this.descriptionStatusSubQuery != null) query.descriptionStatusSubQuery(this.descriptionStatusSubQuery.enrich(queryFactory));
this.enrichCommon(query); this.enrichCommon(query);
@ -154,7 +163,7 @@ public class DescriptionLookup extends Lookup {
if (this.like != null) query.like(StringUtils.strip(this.like, "%")); if (this.like != null) query.like(StringUtils.strip(this.like, "%"));
if (this.ids != null) query.ids(this.ids); if (this.ids != null) query.ids(this.ids);
if (this.excludedIds != null) query.excludedIds(this.excludedIds); if (this.excludedIds != null) query.excludedIds(this.excludedIds);
if (this.statuses != null) query.statuses(this.statuses); if (this.statusIds != null) query.statusIds(this.statusIds);
if (this.createdAfter != null) query.createdAfter(this.createdAfter); if (this.createdAfter != null) query.createdAfter(this.createdAfter);
if (this.createdBefore != null) query.createdBefore(this.createdBefore); if (this.createdBefore != null) query.createdBefore(this.createdBefore);
if (this.finalizedAfter != null) query.finalizedAfter(this.finalizedAfter); if (this.finalizedAfter != null) query.finalizedAfter(this.finalizedAfter);

View File

@ -4,7 +4,6 @@ import gr.cite.tools.data.query.Lookup;
import gr.cite.tools.data.query.QueryFactory; import gr.cite.tools.data.query.QueryFactory;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.opencdmp.commons.enums.PlanAccessType; import org.opencdmp.commons.enums.PlanAccessType;
import org.opencdmp.commons.enums.PlanStatus;
import org.opencdmp.commons.enums.PlanVersionStatus; import org.opencdmp.commons.enums.PlanVersionStatus;
import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.elastic.query.PlanElasticQuery; import org.opencdmp.elastic.query.PlanElasticQuery;
@ -27,7 +26,7 @@ public class PlanLookup extends Lookup {
private List<IsActive> isActive; private List<IsActive> isActive;
private List<PlanVersionStatus> versionStatuses; private List<PlanVersionStatus> versionStatuses;
private List<PlanStatus> statuses; private List<UUID> statusIds;
private List<PlanAccessType> accessTypes; private List<PlanAccessType> accessTypes;
private List<Integer> versions; private List<Integer> versions;
@ -36,6 +35,7 @@ public class PlanLookup extends Lookup {
private PlanUserLookup planUserSubQuery; private PlanUserLookup planUserSubQuery;
private PlanBlueprintLookup planBlueprintSubQuery; private PlanBlueprintLookup planBlueprintSubQuery;
private PlanReferenceLookup planReferenceSubQuery; private PlanReferenceLookup planReferenceSubQuery;
private PlanStatusLookup planStatusSubQuery;
public String getLike() { public String getLike() {
return this.like; return this.like;
@ -73,12 +73,12 @@ public class PlanLookup extends Lookup {
this.isActive = isActive; this.isActive = isActive;
} }
public List<PlanStatus> getStatuses() { public List<UUID> getStatusIds() {
return this.statuses; return statusIds;
} }
public void setStatuses(List<PlanStatus> statuses) { public void setStatusIds(List<UUID> statusIds) {
this.statuses = statuses; this.statusIds = statusIds;
} }
public List<Integer> getVersions() { public List<Integer> getVersions() {
@ -138,6 +138,14 @@ public class PlanLookup extends Lookup {
public void setPlanReferenceLookup(PlanReferenceLookup planReferenceSubQuery) { this.planReferenceSubQuery = planReferenceSubQuery; } public void setPlanReferenceLookup(PlanReferenceLookup planReferenceSubQuery) { this.planReferenceSubQuery = planReferenceSubQuery; }
public PlanStatusLookup getPlanStatusSubQuery() {
return planStatusSubQuery;
}
public void setPlanStatusSubQuery(PlanStatusLookup planStatusSubQuery) {
this.planStatusSubQuery = planStatusSubQuery;
}
public PlanQuery enrich(QueryFactory queryFactory) { public PlanQuery enrich(QueryFactory queryFactory) {
PlanQuery query = queryFactory.query(PlanQuery.class); PlanQuery query = queryFactory.query(PlanQuery.class);
if (this.like != null) query.like(this.like); if (this.like != null) query.like(this.like);
@ -147,13 +155,14 @@ public class PlanLookup extends Lookup {
if (this.excludedIds != null) query.excludedIds(this.excludedIds); if (this.excludedIds != null) query.excludedIds(this.excludedIds);
if (this.accessTypes != null) query.accessTypes(this.accessTypes); if (this.accessTypes != null) query.accessTypes(this.accessTypes);
if (this.isActive != null) query.isActive(this.isActive); if (this.isActive != null) query.isActive(this.isActive);
if (this.statuses != null) query.statuses(this.statuses); if (this.statusIds != null) query.statusIds(this.statusIds);
if (this.versions != null) query.versions(this.versions); if (this.versions != null) query.versions(this.versions);
if (this.versionStatuses != null) query.versionStatuses(this.versionStatuses); if (this.versionStatuses != null) query.versionStatuses(this.versionStatuses);
if (this.planDescriptionTemplateSubQuery != null) query.planDescriptionTemplateSubQuery(this.planDescriptionTemplateSubQuery.enrich(queryFactory)); if (this.planDescriptionTemplateSubQuery != null) query.planDescriptionTemplateSubQuery(this.planDescriptionTemplateSubQuery.enrich(queryFactory));
if (this.planUserSubQuery != null) query.planUserSubQuery(this.planUserSubQuery.enrich(queryFactory)); if (this.planUserSubQuery != null) query.planUserSubQuery(this.planUserSubQuery.enrich(queryFactory));
if (this.planBlueprintSubQuery != null) query.planBlueprintSubQuery(this.planBlueprintSubQuery.enrich(queryFactory)); if (this.planBlueprintSubQuery != null) query.planBlueprintSubQuery(this.planBlueprintSubQuery.enrich(queryFactory));
if (this.planReferenceSubQuery != null) query.planReferenceSubQuery(this.planReferenceSubQuery.enrich(queryFactory)); if (this.planReferenceSubQuery != null) query.planReferenceSubQuery(this.planReferenceSubQuery.enrich(queryFactory));
if (this.planStatusSubQuery != null) query.planStatusSubQuery(this.planStatusSubQuery.enrich(queryFactory));
this.enrichCommon(query); this.enrichCommon(query);
@ -167,7 +176,7 @@ public class PlanLookup extends Lookup {
if (this.groupIds != null) query.groupIds(this.groupIds); if (this.groupIds != null) query.groupIds(this.groupIds);
if (this.excludedIds != null) query.excludedIds(this.excludedIds); if (this.excludedIds != null) query.excludedIds(this.excludedIds);
if (this.accessTypes != null) query.accessTypes(this.accessTypes); if (this.accessTypes != null) query.accessTypes(this.accessTypes);
if (this.statuses != null) query.statuses(this.statuses); if (this.statusIds != null) query.statuses(this.statusIds);
if (this.versions != null) query.versions(this.versions); if (this.versions != null) query.versions(this.versions);
if (this.versionStatuses != null) query.versionStatuses(this.versionStatuses); if (this.versionStatuses != null) query.versionStatuses(this.versionStatuses);
if (this.planDescriptionTemplateSubQuery != null) query.planDescriptionTemplateSubQuery(this.planDescriptionTemplateSubQuery.enrichElasticInner(queryFactory)); if (this.planDescriptionTemplateSubQuery != null) query.planDescriptionTemplateSubQuery(this.planDescriptionTemplateSubQuery.enrichElasticInner(queryFactory));
@ -175,6 +184,7 @@ public class PlanLookup extends Lookup {
if (this.planBlueprintSubQuery != null && this.planBlueprintSubQuery.getIds() != null && !this.planBlueprintSubQuery.getIds().isEmpty()) query.blueprintIds(this.planBlueprintSubQuery.getIds()); if (this.planBlueprintSubQuery != null && this.planBlueprintSubQuery.getIds() != null && !this.planBlueprintSubQuery.getIds().isEmpty()) query.blueprintIds(this.planBlueprintSubQuery.getIds());
if (this.planReferenceSubQuery != null) query.referenceSubQuery(this.planReferenceSubQuery.enrichElasticInner(queryFactory)); if (this.planReferenceSubQuery != null) query.referenceSubQuery(this.planReferenceSubQuery.enrichElasticInner(queryFactory));
if (this.tenantSubQuery != null) throw new UnsupportedOperationException(); if (this.tenantSubQuery != null) throw new UnsupportedOperationException();
if (this.planStatusSubQuery != null) throw new UnsupportedOperationException();
this.enrichCommon(query); this.enrichCommon(query);
@ -188,7 +198,7 @@ public class PlanLookup extends Lookup {
if (this.groupIds != null) query.groupIds(this.groupIds); if (this.groupIds != null) query.groupIds(this.groupIds);
if (this.excludedIds != null) query.excludedIds(this.excludedIds); if (this.excludedIds != null) query.excludedIds(this.excludedIds);
if (this.accessTypes != null) query.accessTypes(this.accessTypes); if (this.accessTypes != null) query.accessTypes(this.accessTypes);
if (this.statuses != null) query.statuses(this.statuses); if (this.statusIds != null) query.statusIds(this.statusIds);
if (this.versions != null) query.versions(this.versions); if (this.versions != null) query.versions(this.versions);
if (this.versionStatuses != null) query.versionStatuses(this.versionStatuses); if (this.versionStatuses != null) query.versionStatuses(this.versionStatuses);
if (this.planDescriptionTemplateSubQuery != null) throw new UnsupportedOperationException(""); if (this.planDescriptionTemplateSubQuery != null) throw new UnsupportedOperationException("");
@ -196,6 +206,7 @@ public class PlanLookup extends Lookup {
if (this.planBlueprintSubQuery != null && this.planBlueprintSubQuery.getIds() != null && !this.planBlueprintSubQuery.getIds().isEmpty()) throw new UnsupportedOperationException(""); if (this.planBlueprintSubQuery != null && this.planBlueprintSubQuery.getIds() != null && !this.planBlueprintSubQuery.getIds().isEmpty()) throw new UnsupportedOperationException("");
if (this.planReferenceSubQuery != null) throw new UnsupportedOperationException(""); if (this.planReferenceSubQuery != null) throw new UnsupportedOperationException("");
if (this.tenantSubQuery != null) throw new UnsupportedOperationException(); if (this.tenantSubQuery != null) throw new UnsupportedOperationException();
if (this.planStatusSubQuery != null) throw new UnsupportedOperationException();
return query; return query;
} }

View File

@ -77,9 +77,9 @@ public class DashboardServiceImpl implements DashboardService {
descriptionLookup.getPage().setOffset(0); descriptionLookup.getPage().setOffset(0);
descriptionLookup.getPage().setSize(model.getPage().getSize()+model.getPage().getOffset()); descriptionLookup.getPage().setSize(model.getPage().getSize()+model.getPage().getOffset());
QueryResult<Description> descriptions = this.elasticQueryHelperService.collect(descriptionLookup, AuthorizationFlags.AllExceptPublic, new BaseFieldSet().ensure(Description._id).ensure(Description._updatedAt).ensure(String.join(".",Description._status, org.opencdmp.model.descriptionstatus.DescriptionStatus._internalStatus)).ensure(Description._label)); QueryResult<Description> descriptions = this.elasticQueryHelperService.collect(descriptionLookup, AuthorizationFlags.AllExceptPublic, new BaseFieldSet().ensure(Description._id).ensure(Description._updatedAt).ensure(String.join(".",Description._status, org.opencdmp.model.descriptionstatus.DescriptionStatus._id)).ensure(Description._label));
if (!this.conventionService.isListNullOrEmpty(descriptions.getItems())) { if (!this.conventionService.isListNullOrEmpty(descriptions.getItems())) {
for (Description description : descriptions.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Description, description.getId(), description.getUpdatedAt(), description.getLabel(), description.getStatus().getInternalStatus().getValue())); for (Description description : descriptions.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Description, description.getId(), description.getUpdatedAt(), description.getLabel(), description.getStatus().getId()));
} }
} }
@ -88,9 +88,9 @@ public class DashboardServiceImpl implements DashboardService {
planLookup.getPage().setOffset(0); planLookup.getPage().setOffset(0);
planLookup.getPage().setSize(model.getPage().getSize()+model.getPage().getOffset()); planLookup.getPage().setSize(model.getPage().getSize()+model.getPage().getOffset());
QueryResult<Plan> plans = this.elasticQueryHelperService.collect(planLookup, AuthorizationFlags.AllExceptPublic, new BaseFieldSet().ensure(Plan._id).ensure(Plan._updatedAt).ensure(Plan._label).ensure(String.join(".",Plan._status, org.opencdmp.model.planstatus.PlanStatus._internalStatus))); QueryResult<Plan> plans = this.elasticQueryHelperService.collect(planLookup, AuthorizationFlags.AllExceptPublic, new BaseFieldSet().ensure(Plan._id).ensure(Plan._updatedAt).ensure(Plan._label).ensure(String.join(".",Plan._status, org.opencdmp.model.planstatus.PlanStatus._id)));
if (!this.conventionService.isListNullOrEmpty(plans.getItems())) { if (!this.conventionService.isListNullOrEmpty(plans.getItems())) {
for (Plan plan : plans.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Plan, plan.getId(), plan.getUpdatedAt(), plan.getLabel(), plan.getStatus().getInternalStatus().getValue())); for (Plan plan : plans.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Plan, plan.getId(), plan.getUpdatedAt(), plan.getLabel(), plan.getStatus().getId()));
} }
} }
@ -100,7 +100,7 @@ public class DashboardServiceImpl implements DashboardService {
switch (model.getOrderField()){ switch (model.getOrderField()){
case Label -> comparator = Comparator.comparing(RecentActivityItemEntity::getLabel).thenComparing(RecentActivityItemEntity::getUpdatedAt); case Label -> comparator = Comparator.comparing(RecentActivityItemEntity::getLabel).thenComparing(RecentActivityItemEntity::getUpdatedAt);
case UpdatedAt -> comparator = Comparator.comparing(RecentActivityItemEntity::getUpdatedAt); case UpdatedAt -> comparator = Comparator.comparing(RecentActivityItemEntity::getUpdatedAt);
case Status -> comparator = Comparator.comparing(RecentActivityItemEntity::getStatusValue).thenComparing(RecentActivityItemEntity::getUpdatedAt); case Status -> comparator = Comparator.comparing(RecentActivityItemEntity::getStatusId).thenComparing(RecentActivityItemEntity::getUpdatedAt);
default -> throw new IllegalArgumentException("Type not found" + model.getOrderField()) ; default -> throw new IllegalArgumentException("Type not found" + model.getOrderField()) ;
} }
} }
@ -118,10 +118,12 @@ public class DashboardServiceImpl implements DashboardService {
DashboardStatisticsCacheService.DashboardStatisticsCacheValue cacheValue = this.dashboardStatisticsCacheService.lookup(this.dashboardStatisticsCacheService.buildKey(DashboardStatisticsCacheService.publicKey)); DashboardStatisticsCacheService.DashboardStatisticsCacheValue cacheValue = this.dashboardStatisticsCacheService.lookup(this.dashboardStatisticsCacheService.buildKey(DashboardStatisticsCacheService.publicKey));
if (cacheValue == null || cacheValue.getDashboardStatistics() == null) { if (cacheValue == null || cacheValue.getDashboardStatistics() == null) {
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().isActive(IsActive.Active).versionStatuses(PlanVersionStatus.Current).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public); PlanStatusQuery planStatusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().isActive(IsActive.Active).versionStatuses(PlanVersionStatus.Current).planStatusSubQuery(planStatusQuery).accessTypes(PlanAccessType.Public);
DashboardStatistics statistics = new DashboardStatistics(); DashboardStatistics statistics = new DashboardStatistics();
statistics.setPlanCount(planQuery.authorize(EnumSet.of(Public)).count()); statistics.setPlanCount(planQuery.authorize(EnumSet.of(Public)).count());
statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).planSubQuery(planQuery).statuses(DescriptionStatus.Finalized).authorize(EnumSet.of(Public)).count()); DescriptionStatusQuery descriptionStatusQuery = this.queryFactory.query(DescriptionStatusQuery.class).disableTracking().internalStatuses(DescriptionStatus.Finalized).isActive(IsActive.Active);
statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).planSubQuery(planQuery).descriptionStatusSubQuery(descriptionStatusQuery).authorize(EnumSet.of(Public)).count());
statistics.setReferenceTypeStatistics(new ArrayList<>()); statistics.setReferenceTypeStatistics(new ArrayList<>());
if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){ if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){

View File

@ -1200,7 +1200,8 @@ public class DescriptionServiceImpl implements DescriptionService {
} else { } else {
try { try {
this.entityManager.disableTenantFilters(); this.entityManager.disableTenantFilters();
data = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).planSubQuery(this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public)).first(); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
data = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).planSubQuery(this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).planStatusSubQuery(statusQuery).accessTypes(PlanAccessType.Public)).first();
this.entityManager.reloadTenantFilters(); this.entityManager.reloadTenantFilters();
} finally { } finally {
this.entityManager.reloadTenantFilters(); this.entityManager.reloadTenantFilters();
@ -1233,7 +1234,8 @@ public class DescriptionServiceImpl implements DescriptionService {
DescriptionEntity data = null; DescriptionEntity data = null;
try { try {
this.entityManager.disableTenantFilters(); this.entityManager.disableTenantFilters();
data = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).planSubQuery(this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public)).first(); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
data = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).planSubQuery(this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).planStatusSubQuery(statusQuery).accessTypes(PlanAccessType.Public)).first();
this.entityManager.reloadTenantFilters(); this.entityManager.reloadTenantFilters();
} finally { } finally {
this.entityManager.reloadTenantFilters(); this.entityManager.reloadTenantFilters();

View File

@ -136,7 +136,7 @@ public class ElasticServiceImpl implements ElasticService {
propertyMap.put(DescriptionElasticEntity._tenantId, this.createElastic(FieldType.Keyword, false)); propertyMap.put(DescriptionElasticEntity._tenantId, this.createElastic(FieldType.Keyword, false));
propertyMap.put(DescriptionElasticEntity._label, this.createElastic(FieldType.Text, true)); propertyMap.put(DescriptionElasticEntity._label, this.createElastic(FieldType.Text, true));
propertyMap.put(DescriptionElasticEntity._description, this.createElastic(FieldType.Text, true)); propertyMap.put(DescriptionElasticEntity._description, this.createElastic(FieldType.Text, true));
propertyMap.put(DescriptionElasticEntity._status, this.createElastic(FieldType.Short, false)); propertyMap.put(DescriptionElasticEntity._statusId, this.createElastic(FieldType.Keyword, false));
propertyMap.put(DescriptionElasticEntity._finalizedAt, this.createElastic(FieldType.Date, false)); propertyMap.put(DescriptionElasticEntity._finalizedAt, this.createElastic(FieldType.Date, false));
propertyMap.put(DescriptionElasticEntity._createdAt, this.createElastic(FieldType.Date, false)); propertyMap.put(DescriptionElasticEntity._createdAt, this.createElastic(FieldType.Date, false));
propertyMap.put(DescriptionElasticEntity._updatedAt, this.createElastic(FieldType.Date, false)); propertyMap.put(DescriptionElasticEntity._updatedAt, this.createElastic(FieldType.Date, false));
@ -154,7 +154,7 @@ public class ElasticServiceImpl implements ElasticService {
propertyMap.put(PlanElasticEntity._tenantId, this.createElastic(FieldType.Keyword, false)); propertyMap.put(PlanElasticEntity._tenantId, this.createElastic(FieldType.Keyword, false));
propertyMap.put(PlanElasticEntity._label, this.createElastic(FieldType.Text, true)); propertyMap.put(PlanElasticEntity._label, this.createElastic(FieldType.Text, true));
propertyMap.put(PlanElasticEntity._description, this.createElastic(FieldType.Text, false)); propertyMap.put(PlanElasticEntity._description, this.createElastic(FieldType.Text, false));
propertyMap.put(PlanElasticEntity._status, this.createElastic(FieldType.Short, false)); propertyMap.put(PlanElasticEntity._statusId, this.createElastic(FieldType.Keyword, false));
propertyMap.put(PlanElasticEntity._version, this.createElastic(FieldType.Short, false)); propertyMap.put(PlanElasticEntity._version, this.createElastic(FieldType.Short, false));
propertyMap.put(PlanElasticEntity._language, this.createElastic(FieldType.Keyword, false)); propertyMap.put(PlanElasticEntity._language, this.createElastic(FieldType.Keyword, false));
propertyMap.put(PlanElasticEntity._blueprintId, this.createElastic(FieldType.Keyword, false)); propertyMap.put(PlanElasticEntity._blueprintId, this.createElastic(FieldType.Keyword, false));
@ -230,7 +230,7 @@ public class ElasticServiceImpl implements ElasticService {
propertyMap.put(NestedPlanElasticEntity._id, this.createElastic(FieldType.Keyword, false)); propertyMap.put(NestedPlanElasticEntity._id, this.createElastic(FieldType.Keyword, false));
propertyMap.put(NestedPlanElasticEntity._label, this.createElastic(FieldType.Text, true)); propertyMap.put(NestedPlanElasticEntity._label, this.createElastic(FieldType.Text, true));
propertyMap.put(NestedPlanElasticEntity._description, this.createElastic(FieldType.Text, false)); propertyMap.put(NestedPlanElasticEntity._description, this.createElastic(FieldType.Text, false));
propertyMap.put(NestedPlanElasticEntity._status, this.createElastic(FieldType.Short, false)); propertyMap.put(NestedPlanElasticEntity._statusId, this.createElastic(FieldType.Keyword, false));
propertyMap.put(NestedPlanElasticEntity._version, this.createElastic(FieldType.Short, false)); propertyMap.put(NestedPlanElasticEntity._version, this.createElastic(FieldType.Short, false));
propertyMap.put(NestedPlanElasticEntity._versionStatus, this.createElastic(FieldType.Short, false)); propertyMap.put(NestedPlanElasticEntity._versionStatus, this.createElastic(FieldType.Short, false));
propertyMap.put(NestedPlanElasticEntity._language, this.createElastic(FieldType.Keyword, false)); propertyMap.put(NestedPlanElasticEntity._language, this.createElastic(FieldType.Keyword, false));

View File

@ -268,7 +268,8 @@ public class FileTransformerServiceImpl implements FileTransformerService {
} else { } else {
try { try {
this.entityManager.disableTenantFilters(); this.entityManager.disableTenantFilters();
entity = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(planId).isActive(IsActive.Active).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public).first(); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
entity = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(planId).isActive(IsActive.Active).planStatusSubQuery(statusQuery).accessTypes(PlanAccessType.Public).first();
this.entityManager.reloadTenantFilters(); this.entityManager.reloadTenantFilters();
} finally { } finally {
this.entityManager.reloadTenantFilters(); this.entityManager.reloadTenantFilters();
@ -307,7 +308,8 @@ public class FileTransformerServiceImpl implements FileTransformerService {
} else { } else {
try { try {
this.entityManager.disableTenantFilters(); this.entityManager.disableTenantFilters();
entity = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(descriptionId).planSubQuery(this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public)).first(); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
entity = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(descriptionId).planSubQuery(this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).planStatusSubQuery(statusQuery).accessTypes(PlanAccessType.Public)).first();
this.entityManager.reloadTenantFilters(); this.entityManager.reloadTenantFilters();
} finally { } finally {
this.entityManager.reloadTenantFilters(); this.entityManager.reloadTenantFilters();

View File

@ -325,21 +325,24 @@ public class MetricsServiceImpl implements MetricsService {
} }
private double calculateDraftDmps(boolean forNexus) { private double calculateDraftDmps(boolean forNexus) {
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().statuses(PlanStatus.Draft).isActive(IsActive.Active); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Draft).isActives(IsActive.Active);
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().planStatusSubQuery(statusQuery).isActive(IsActive.Active);
if (forNexus) if (forNexus)
planQuery.after(this._config.getNexusDate()); planQuery.after(this._config.getNexusDate());
return planQuery.count(); return planQuery.count();
} }
private double calculateFinalizedDmps(boolean forNexus) { private double calculateFinalizedDmps(boolean forNexus) {
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().statuses(PlanStatus.Finalized).isActive(IsActive.Active); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().planStatusSubQuery(statusQuery).isActive(IsActive.Active);
if (forNexus) if (forNexus)
planQuery.after(this._config.getNexusDate()); planQuery.after(this._config.getNexusDate());
return planQuery.count(); return planQuery.count();
} }
private double calculatePublishedDmps(boolean forNexus) { private double calculatePublishedDmps(boolean forNexus) {
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public).isActive(IsActive.Active); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().planStatusSubQuery(statusQuery).accessTypes(PlanAccessType.Public).isActive(IsActive.Active);
if (forNexus) if (forNexus)
planQuery.after(this._config.getNexusDate()); planQuery.after(this._config.getNexusDate());
return planQuery.count(); return planQuery.count();
@ -355,8 +358,10 @@ public class MetricsServiceImpl implements MetricsService {
return planQuery.count(); return planQuery.count();
} }
private double calculateDraftDmpsWithGrant(boolean forNexus) { private double calculateDraftDmpsWithGrant(boolean forNexus)
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).statuses(PlanStatus.Draft).disableTracking().isActive(IsActive.Active); {
PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Draft).isActives(IsActive.Active);
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).planStatusSubQuery(statusQuery).disableTracking().isActive(IsActive.Active);
if (forNexus) if (forNexus)
planQuery.after(this._config.getNexusDate()); planQuery.after(this._config.getNexusDate());
ReferenceQuery referenceQuery = this.queryFactory.query(ReferenceQuery.class).disableTracking().typeIds(this._config.getReferenceTypes().getGrantIds()).isActive(IsActive.Active); ReferenceQuery referenceQuery = this.queryFactory.query(ReferenceQuery.class).disableTracking().typeIds(this._config.getReferenceTypes().getGrantIds()).isActive(IsActive.Active);
@ -366,7 +371,8 @@ public class MetricsServiceImpl implements MetricsService {
} }
private double calculateFinalizedDmpsWithGrant(boolean forNexus) { private double calculateFinalizedDmpsWithGrant(boolean forNexus) {
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().statuses(PlanStatus.Finalized).isActive(IsActive.Active); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().planStatusSubQuery(statusQuery).isActive(IsActive.Active);
if (forNexus) if (forNexus)
planQuery.after(this._config.getNexusDate()); planQuery.after(this._config.getNexusDate());
ReferenceQuery referenceQuery = this.queryFactory.query(ReferenceQuery.class).disableTracking().typeIds(this._config.getReferenceTypes().getGrantIds()).isActive(IsActive.Active); ReferenceQuery referenceQuery = this.queryFactory.query(ReferenceQuery.class).disableTracking().typeIds(this._config.getReferenceTypes().getGrantIds()).isActive(IsActive.Active);
@ -376,7 +382,8 @@ public class MetricsServiceImpl implements MetricsService {
} }
private double calculatePublishedDmpsWithGrant(boolean forNexus) { private double calculatePublishedDmpsWithGrant(boolean forNexus) {
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).statuses(PlanStatus.Finalized).disableTracking().accessTypes(PlanAccessType.Public).isActive(IsActive.Active); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).planStatusSubQuery(statusQuery).disableTracking().accessTypes(PlanAccessType.Public).isActive(IsActive.Active);
if (forNexus) if (forNexus)
planQuery.after(this._config.getNexusDate()); planQuery.after(this._config.getNexusDate());
ReferenceQuery referenceQuery = this.queryFactory.query(ReferenceQuery.class).disableTracking().typeIds(this._config.getReferenceTypes().getGrantIds()).isActive(IsActive.Active); ReferenceQuery referenceQuery = this.queryFactory.query(ReferenceQuery.class).disableTracking().typeIds(this._config.getReferenceTypes().getGrantIds()).isActive(IsActive.Active);
@ -426,30 +433,35 @@ public class MetricsServiceImpl implements MetricsService {
} }
private double calculateDraftDatasets(boolean forNexus) { private double calculateDraftDatasets(boolean forNexus) {
DescriptionQuery descriptionQuery = this.queryFactory.query(DescriptionQuery.class).disableTracking().statuses(DescriptionStatus.Draft).isActive(IsActive.Active); DescriptionStatusQuery descriptionStatusQuery = this.queryFactory.query(DescriptionStatusQuery.class).disableTracking().internalStatuses(DescriptionStatus.Draft).isActive(IsActive.Active);
DescriptionQuery descriptionQuery = this.queryFactory.query(DescriptionQuery.class).disableTracking().descriptionStatusSubQuery(descriptionStatusQuery).isActive(IsActive.Active);
if (forNexus) if (forNexus)
descriptionQuery.createdAfter(this._config.getNexusDate()); descriptionQuery.createdAfter(this._config.getNexusDate());
return descriptionQuery.count(); return descriptionQuery.count();
} }
private double calculateFinalizedDatasets(boolean forNexus) { private double calculateFinalizedDatasets(boolean forNexus) {
DescriptionQuery descriptionQuery = this.queryFactory.query(DescriptionQuery.class).disableTracking().statuses(DescriptionStatus.Finalized).isActive(IsActive.Active); DescriptionStatusQuery descriptionStatusQuery = this.queryFactory.query(DescriptionStatusQuery.class).disableTracking().internalStatuses(DescriptionStatus.Finalized).isActive(IsActive.Active);
DescriptionQuery descriptionQuery = this.queryFactory.query(DescriptionQuery.class).disableTracking().descriptionStatusSubQuery(descriptionStatusQuery).isActive(IsActive.Active);
if (forNexus) if (forNexus)
descriptionQuery.createdAfter(this._config.getNexusDate()); descriptionQuery.createdAfter(this._config.getNexusDate());
return descriptionQuery.count(); return descriptionQuery.count();
} }
private double calculatePublishedDatasets(boolean forNexus) { private double calculatePublishedDatasets(boolean forNexus) {
DescriptionQuery descriptionQuery = this.queryFactory.query(DescriptionQuery.class).disableTracking().statuses(DescriptionStatus.Finalized).isActive(IsActive.Active); DescriptionStatusQuery descriptionStatusQuery = this.queryFactory.query(DescriptionStatusQuery.class).disableTracking().internalStatuses(DescriptionStatus.Finalized).isActive(IsActive.Active);
DescriptionQuery descriptionQuery = this.queryFactory.query(DescriptionQuery.class).disableTracking().descriptionStatusSubQuery(descriptionStatusQuery).isActive(IsActive.Active);
if (forNexus) if (forNexus)
descriptionQuery.createdAfter(this._config.getNexusDate()); descriptionQuery.createdAfter(this._config.getNexusDate());
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).disableTracking().statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).disableTracking().planStatusSubQuery(statusQuery).accessTypes(PlanAccessType.Public);
descriptionQuery.planSubQuery(planQuery); descriptionQuery.planSubQuery(planQuery);
return descriptionQuery.count(); return descriptionQuery.count();
} }
private double calculateDoiedDatasets(boolean forNexus) { private double calculateDoiedDatasets(boolean forNexus) {
DescriptionQuery descriptionQuery = this.queryFactory.query(DescriptionQuery.class).disableTracking().statuses(DescriptionStatus.Finalized).isActive(IsActive.Active); DescriptionStatusQuery descriptionStatusQuery = this.queryFactory.query(DescriptionStatusQuery.class).disableTracking().internalStatuses(DescriptionStatus.Finalized).isActive(IsActive.Active);
DescriptionQuery descriptionQuery = this.queryFactory.query(DescriptionQuery.class).disableTracking().descriptionStatusSubQuery(descriptionStatusQuery).isActive(IsActive.Active);
if (forNexus) if (forNexus)
descriptionQuery.createdAfter(this._config.getNexusDate()); descriptionQuery.createdAfter(this._config.getNexusDate());
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active); PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active);

View File

@ -710,7 +710,8 @@ public class PlanServiceImpl implements PlanService {
List<TagEntity> tags = new ArrayList<>(); List<TagEntity> tags = new ArrayList<>();
try { try {
this.entityManager.disableTenantFilters(); this.entityManager.disableTenantFilters();
existing = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(descriptionId).planSubQuery(this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public)).first(); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
existing = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(descriptionId).planSubQuery(this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).planStatusSubQuery(statusQuery).accessTypes(PlanAccessType.Public)).first();
if (existing == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{descriptionId, Description.class.getSimpleName()}, LocaleContextHolder.getLocale())); if (existing == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{descriptionId, Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
@ -1040,7 +1041,8 @@ public class PlanServiceImpl implements PlanService {
try { try {
this.entityManager.disableTenantFilters(); this.entityManager.disableTenantFilters();
// query for public plan // query for public plan
existingPlanEntity = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(model.getId()).isActive(IsActive.Active).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public).firstAs(fields); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
existingPlanEntity = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(model.getId()).isActive(IsActive.Active).planStatusSubQuery(statusQuery).accessTypes(PlanAccessType.Public).firstAs(fields);
if (existingPlanEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), PublicPlan.class.getSimpleName()}, LocaleContextHolder.getLocale())); if (existingPlanEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), PublicPlan.class.getSimpleName()}, LocaleContextHolder.getLocale()));
@ -2081,7 +2083,8 @@ public class PlanServiceImpl implements PlanService {
} else { } else {
try { try {
this.entityManager.disableTenantFilters(); this.entityManager.disableTenantFilters();
data = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).isActive(IsActive.Active).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public).first(); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
data = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).isActive(IsActive.Active).planStatusSubQuery(statusQuery).accessTypes(PlanAccessType.Public).first();
this.entityManager.reloadTenantFilters(); this.entityManager.reloadTenantFilters();
} finally { } finally {
this.entityManager.reloadTenantFilters(); this.entityManager.reloadTenantFilters();
@ -2115,7 +2118,8 @@ public class PlanServiceImpl implements PlanService {
PlanEntity data = null; PlanEntity data = null;
try { try {
this.entityManager.disableTenantFilters(); this.entityManager.disableTenantFilters();
data = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).isActive(IsActive.Active).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public).first(); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
data = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).isActive(IsActive.Active).planStatusSubQuery(statusQuery).accessTypes(PlanAccessType.Public).first();
this.entityManager.reloadTenantFilters(); this.entityManager.reloadTenantFilters();
} finally { } finally {
this.entityManager.reloadTenantFilters(); this.entityManager.reloadTenantFilters();

View File

@ -45,6 +45,7 @@ import org.opencdmp.model.persist.*;
import org.opencdmp.model.result.QueryResult; import org.opencdmp.model.result.QueryResult;
import org.opencdmp.query.DescriptionQuery; import org.opencdmp.query.DescriptionQuery;
import org.opencdmp.query.PlanQuery; import org.opencdmp.query.PlanQuery;
import org.opencdmp.query.PlanStatusQuery;
import org.opencdmp.query.lookup.DescriptionLookup; import org.opencdmp.query.lookup.DescriptionLookup;
import org.opencdmp.service.description.DescriptionService; import org.opencdmp.service.description.DescriptionService;
import org.opencdmp.service.elastic.ElasticQueryHelperService; import org.opencdmp.service.elastic.ElasticQueryHelperService;
@ -147,7 +148,8 @@ public class DescriptionController {
this.censorFactory.censor(PublicDescriptionCensor.class).censor(fieldSet); this.censorFactory.censor(PublicDescriptionCensor.class).censor(fieldSet);
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).planSubQuery(this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public)); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).planSubQuery(this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).planStatusSubQuery(statusQuery).accessTypes(PlanAccessType.Public));
PublicDescription model = this.builderFactory.builder(PublicDescriptionBuilder.class).authorize(EnumSet.of(Public)).build(fieldSet, query.firstAs(fieldSet)); PublicDescription model = this.builderFactory.builder(PublicDescriptionBuilder.class).authorize(EnumSet.of(Public)).build(fieldSet, query.firstAs(fieldSet));
if (model == null) if (model == null)

View File

@ -43,6 +43,7 @@ import org.opencdmp.model.persist.*;
import org.opencdmp.model.plan.Plan; import org.opencdmp.model.plan.Plan;
import org.opencdmp.model.result.QueryResult; import org.opencdmp.model.result.QueryResult;
import org.opencdmp.query.PlanQuery; import org.opencdmp.query.PlanQuery;
import org.opencdmp.query.PlanStatusQuery;
import org.opencdmp.query.lookup.PlanLookup; import org.opencdmp.query.lookup.PlanLookup;
import org.opencdmp.service.elastic.ElasticQueryHelperService; import org.opencdmp.service.elastic.ElasticQueryHelperService;
import org.opencdmp.service.plan.PlanService; import org.opencdmp.service.plan.PlanService;
@ -131,7 +132,8 @@ public class PlanController {
this.censorFactory.censor(PublicPlanCensor.class).censor(fieldSet); this.censorFactory.censor(PublicPlanCensor.class).censor(fieldSet);
PlanQuery query = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).isActive(IsActive.Active).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public); PlanStatusQuery statusQuery = this.queryFactory.query(PlanStatusQuery.class).disableTracking().internalStatuses(PlanStatus.Finalized).isActives(IsActive.Active);
PlanQuery query = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).isActive(IsActive.Active).planStatusSubQuery(statusQuery).accessTypes(PlanAccessType.Public);
PublicPlan model = this.builderFactory.builder(PublicPlanBuilder.class).authorize(EnumSet.of(Public)).build(fieldSet, query.firstAs(fieldSet)); PublicPlan model = this.builderFactory.builder(PublicPlanBuilder.class).authorize(EnumSet.of(Public)).build(fieldSet, query.firstAs(fieldSet));
if (model == null) if (model == null)

View File

@ -120,8 +120,11 @@ permissions:
BrowseDescriptionStatus: BrowseDescriptionStatus:
roles: roles:
- Admin - Admin
- TenantAdmin - InstallationAdmin
- TenantPlanManager
- TenantConfigManager - TenantConfigManager
- TenantAdmin
- TenantUser
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
@ -174,8 +177,11 @@ permissions:
BrowsePlanStatus: BrowsePlanStatus:
roles: roles:
- Admin - Admin
- TenantAdmin - InstallationAdmin
- TenantPlanManager
- TenantConfigManager - TenantConfigManager
- TenantAdmin
- TenantUser
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false

View File

@ -1,7 +1,6 @@
import { Lookup } from '@common/model/lookup'; import { Lookup } from '@common/model/lookup';
import { Guid } from '@common/types/guid'; import { Guid } from '@common/types/guid';
import { IsActive } from '../common/enum/is-active.enum'; import { IsActive } from '../common/enum/is-active.enum';
import { DescriptionStatusEnum } from '../common/enum/description-status';
import { PlanLookup } from './plan.lookup'; import { PlanLookup } from './plan.lookup';
import { DescriptionReferenceLookup } from './reference.lookup'; import { DescriptionReferenceLookup } from './reference.lookup';
import { DescriptionTagLookup } from './tag.lookup'; import { DescriptionTagLookup } from './tag.lookup';
@ -17,7 +16,7 @@ export class DescriptionLookup extends Lookup implements DescriptionFilter {
finalizedAfter: Date; finalizedAfter: Date;
finalizedBefore: Date; finalizedBefore: Date;
isActive: IsActive[]; isActive: IsActive[];
statuses: DescriptionStatusEnum[]; statusIds: Guid[];
planSubQuery: PlanLookup; planSubQuery: PlanLookup;
tenantSubQuery: TenantLookup; tenantSubQuery: TenantLookup;
@ -39,7 +38,7 @@ export interface DescriptionFilter {
finalizedAfter: Date; finalizedAfter: Date;
finalizedBefore: Date; finalizedBefore: Date;
isActive: IsActive[]; isActive: IsActive[];
statuses: DescriptionStatusEnum[]; statusIds: Guid[];
planSubQuery: PlanLookup; planSubQuery: PlanLookup;
descriptionTemplateSubQuery: DescriptionTemplateLookup; descriptionTemplateSubQuery: DescriptionTemplateLookup;

View File

@ -1,7 +1,6 @@
import { Lookup } from '@common/model/lookup'; import { Lookup } from '@common/model/lookup';
import { Guid } from '@common/types/guid'; import { Guid } from '@common/types/guid';
import { PlanAccessType } from '../common/enum/plan-access-type'; import { PlanAccessType } from '../common/enum/plan-access-type';
import { PlanStatusEnum } from '../common/enum/plan-status';
import { PlanVersionStatus } from '../common/enum/plan-version-status'; import { PlanVersionStatus } from '../common/enum/plan-version-status';
import { IsActive } from '../common/enum/is-active.enum'; import { IsActive } from '../common/enum/is-active.enum';
import { PlanDescriptionTemplateLookup } from './plan-description-template.lookup'; import { PlanDescriptionTemplateLookup } from './plan-description-template.lookup';
@ -9,6 +8,7 @@ import { PlanUserLookup } from './plan-user.lookup';
import { PlanBlueprintLookup } from './plan-blueprint.lookup'; import { PlanBlueprintLookup } from './plan-blueprint.lookup';
import { PlanReferenceLookup } from './reference.lookup'; import { PlanReferenceLookup } from './reference.lookup';
import { TenantLookup } from './tenant.lookup'; import { TenantLookup } from './tenant.lookup';
import { PlanStatusLookup } from './plan-status.lookup';
export class PlanLookup extends Lookup implements PlanFilter { export class PlanLookup extends Lookup implements PlanFilter {
ids: Guid[]; ids: Guid[];
@ -16,7 +16,7 @@ export class PlanLookup extends Lookup implements PlanFilter {
like: string; like: string;
isActive: IsActive[]; isActive: IsActive[];
versionStatuses: PlanVersionStatus[]; versionStatuses: PlanVersionStatus[];
statuses: PlanStatusEnum[]; statusIds: Guid[];
accessTypes: PlanAccessType[]; accessTypes: PlanAccessType[];
versions: Number[]; versions: Number[];
groupIds: Guid[]; groupIds: Guid[];
@ -26,6 +26,7 @@ export class PlanLookup extends Lookup implements PlanFilter {
planBlueprintSubQuery: PlanBlueprintLookup; planBlueprintSubQuery: PlanBlueprintLookup;
planDescriptionTemplateSubQuery: PlanDescriptionTemplateLookup; planDescriptionTemplateSubQuery: PlanDescriptionTemplateLookup;
planReferenceSubQuery: PlanReferenceLookup; planReferenceSubQuery: PlanReferenceLookup;
planStatusSubQuery: PlanStatusLookup;
constructor() { constructor() {
super(); super();
@ -38,7 +39,7 @@ export interface PlanFilter {
like: string; like: string;
isActive: IsActive[]; isActive: IsActive[];
versionStatuses: PlanVersionStatus[]; versionStatuses: PlanVersionStatus[];
statuses: PlanStatusEnum[]; statusIds: Guid[];
accessTypes: PlanAccessType[]; accessTypes: PlanAccessType[];
versions: Number[]; versions: Number[];
groupIds: Guid[]; groupIds: Guid[];
@ -47,4 +48,5 @@ export interface PlanFilter {
planBlueprintSubQuery: PlanBlueprintLookup; planBlueprintSubQuery: PlanBlueprintLookup;
planDescriptionTemplateSubQuery: PlanDescriptionTemplateLookup; planDescriptionTemplateSubQuery: PlanDescriptionTemplateLookup;
planReferenceSubQuery: PlanReferenceLookup; planReferenceSubQuery: PlanReferenceLookup;
planStatusSubQuery: PlanStatusLookup;
} }

View File

@ -3,7 +3,7 @@ import { Injectable } from "@angular/core";
import { BaseHttpV2Service } from "../http/base-http-v2.service"; import { BaseHttpV2Service } from "../http/base-http-v2.service";
import { ConfigurationService } from "../configuration/configuration.service"; import { ConfigurationService } from "../configuration/configuration.service";
import { QueryResult } from "@common/model/query-result"; import { QueryResult } from "@common/model/query-result";
import { catchError, Observable, throwError } from "rxjs"; import { catchError, map, Observable, throwError } from "rxjs";
import { Guid } from "@common/types/guid"; import { Guid } from "@common/types/guid";
import { DescriptionStatusLookup } from "@app/core/query/description-status.lookup"; import { DescriptionStatusLookup } from "@app/core/query/description-status.lookup";
import { DescriptionStatus } from "@app/core/model/description-status/description-status"; import { DescriptionStatus } from "@app/core/model/description-status/description-status";
@ -12,6 +12,8 @@ import { IsActive } from "@app/core/common/enum/is-active.enum";
import { nameof } from "ts-simple-nameof"; import { nameof } from "ts-simple-nameof";
import { FilterService } from "@common/modules/text-filter/filter-service"; import { FilterService } from "@common/modules/text-filter/filter-service";
import { DescriptionStatusEnum } from "@app/core/common/enum/description-status"; import { DescriptionStatusEnum } from "@app/core/common/enum/description-status";
import { SingleAutoCompleteConfiguration } from "@app/library/auto-complete/single/single-auto-complete-configuration";
import { MultipleAutoCompleteConfiguration } from "@app/library/auto-complete/multiple/multiple-auto-complete-configuration";
@Injectable() @Injectable()
export class DescriptionStatusService { export class DescriptionStatusService {
@ -65,6 +67,43 @@ export class DescriptionStatusService {
catchError((error: any) => throwError(() => error))); catchError((error: any) => throwError(() => error)));
} }
// tslint:disable-next-line: member-ordering
singleAutocompleteConfiguration: SingleAutoCompleteConfiguration = {
initialItems: (data?: any) => this.query(this.buildAutocompleteLookup([IsActive.Active])).pipe(map(x => x.items)),
filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteLookup([IsActive.Active], searchQuery)).pipe(map(x => x.items)),
getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteLookup([IsActive.Active, IsActive.Inactive], null, null, [selectedItem])).pipe(map(x => x.items[0])),
displayFn: (item: DescriptionStatus) => item.name,
titleFn: (item: DescriptionStatus) => item.name,
valueAssign: (item: DescriptionStatus) => item.id,
};
// tslint:disable-next-line: member-ordering
multipleAutocompleteConfiguration: MultipleAutoCompleteConfiguration = {
initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup([IsActive.Active], null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)),
filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteLookup([IsActive.Active],searchQuery, excludedItems)).pipe(map(x => x.items)),
getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteLookup([IsActive.Active, IsActive.Inactive], null, null, selectedItems)).pipe(map(x => x.items)),
displayFn: (item: DescriptionStatus) => item.name,
titleFn: (item: DescriptionStatus) => item.name,
valueAssign: (item: DescriptionStatus) => item.id,
};
public buildAutocompleteLookup(isActive: IsActive[], like?: string, excludedIds?: Guid[], ids?: Guid[]): DescriptionStatusLookup {
const lookup: DescriptionStatusLookup = new DescriptionStatusLookup();
lookup.page = { size: 100, offset: 0 };
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
if (ids && ids.length > 0) { lookup.ids = ids; }
lookup.isActive = isActive;
lookup.project = {
fields: [
nameof<DescriptionStatus>(x => x.id),
nameof<DescriptionStatus>(x => x.name)
]
};
lookup.order = { items: [nameof<DescriptionStatus>(x => x.name)] };
if (like) { lookup.like = this.filterService.transformLike(like); }
return lookup;
}
buildLookup(params: { buildLookup(params: {
like?: string, like?: string,
excludedIds?: Guid[], excludedIds?: Guid[],

View File

@ -5,14 +5,15 @@ import { ConfigurationService } from "../configuration/configuration.service";
import { PlanStatusLookup } from "@app/core/query/plan-status.lookup"; import { PlanStatusLookup } from "@app/core/query/plan-status.lookup";
import { PlanStatus } from "@app/core/model/plan-status/plan-status"; import { PlanStatus } from "@app/core/model/plan-status/plan-status";
import { QueryResult } from "@common/model/query-result"; import { QueryResult } from "@common/model/query-result";
import { catchError, Observable, throwError } from "rxjs"; import { catchError, map, Observable, throwError } from "rxjs";
import { PlanStatusPersist } from "@app/core/model/plan-status/plan-status-persist"; import { PlanStatusPersist } from "@app/core/model/plan-status/plan-status-persist";
import { Guid } from "@common/types/guid"; import { Guid } from "@common/types/guid";
import { PlanLookup } from "@app/core/query/plan.lookup";
import { FilterService } from "@common/modules/text-filter/filter-service"; import { FilterService } from "@common/modules/text-filter/filter-service";
import { IsActive } from "@notification-service/core/enum/is-active.enum"; import { IsActive } from "@notification-service/core/enum/is-active.enum";
import { nameof } from "ts-simple-nameof"; import { nameof } from "ts-simple-nameof";
import { PlanStatusEnum } from "@app/core/common/enum/plan-status"; import { PlanStatusEnum } from "@app/core/common/enum/plan-status";
import { SingleAutoCompleteConfiguration } from "@app/library/auto-complete/single/single-auto-complete-configuration";
import { MultipleAutoCompleteConfiguration } from "@app/library/auto-complete/multiple/multiple-auto-complete-configuration";
@Injectable() @Injectable()
export class PlanStatusService { export class PlanStatusService {
@ -66,6 +67,43 @@ export class PlanStatusService {
catchError((error: any) => throwError(() => error))); catchError((error: any) => throwError(() => error)));
} }
// tslint:disable-next-line: member-ordering
singleAutocompleteConfiguration: SingleAutoCompleteConfiguration = {
initialItems: (data?: any) => this.query(this.buildAutocompleteLookup([IsActive.Active])).pipe(map(x => x.items)),
filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteLookup([IsActive.Active], searchQuery)).pipe(map(x => x.items)),
getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteLookup([IsActive.Active, IsActive.Inactive], null, null, [selectedItem])).pipe(map(x => x.items[0])),
displayFn: (item: PlanStatus) => item.name,
titleFn: (item: PlanStatus) => item.name,
valueAssign: (item: PlanStatus) => item.id,
};
// tslint:disable-next-line: member-ordering
multipleAutocompleteConfiguration: MultipleAutoCompleteConfiguration = {
initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup([IsActive.Active], null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)),
filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteLookup([IsActive.Active],searchQuery, excludedItems)).pipe(map(x => x.items)),
getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteLookup([IsActive.Active, IsActive.Inactive], null, null, selectedItems)).pipe(map(x => x.items)),
displayFn: (item: PlanStatus) => item.name,
titleFn: (item: PlanStatus) => item.name,
valueAssign: (item: PlanStatus) => item.id,
};
public buildAutocompleteLookup(isActive: IsActive[], like?: string, excludedIds?: Guid[], ids?: Guid[]): PlanStatusLookup {
const lookup: PlanStatusLookup = new PlanStatusLookup();
lookup.page = { size: 100, offset: 0 };
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
if (ids && ids.length > 0) { lookup.ids = ids; }
lookup.isActive = isActive;
lookup.project = {
fields: [
nameof<PlanStatus>(x => x.id),
nameof<PlanStatus>(x => x.name)
]
};
lookup.order = { items: [nameof<PlanStatus>(x => x.name)] };
if (like) { lookup.like = this.filterService.transformLike(like); }
return lookup;
}
buildLookup(params: { buildLookup(params: {
like?: string, like?: string,
excludedIds?: Guid[], excludedIds?: Guid[],

View File

@ -251,13 +251,13 @@ export class PlanService {
valueAssign: (item: Plan) => item.id, valueAssign: (item: Plan) => item.id,
}; };
public buildAutocompleteLookup(isActive: IsActive[], like?: string, excludedIds?: Guid[], ids?: Guid[], statuses?: PlanStatusEnum[], planDescriptionTemplateSubQuery?: PlanDescriptionTemplateLookup): PlanLookup { public buildAutocompleteLookup(isActive: IsActive[], like?: string, excludedIds?: Guid[], ids?: Guid[], statusIds?: Guid[], planDescriptionTemplateSubQuery?: PlanDescriptionTemplateLookup): PlanLookup {
const lookup: PlanLookup = new PlanLookup(); const lookup: PlanLookup = new PlanLookup();
lookup.page = { size: 100, offset: 0 }; lookup.page = { size: 100, offset: 0 };
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
if (ids && ids.length > 0) { lookup.ids = ids; } if (ids && ids.length > 0) { lookup.ids = ids; }
lookup.isActive = isActive; lookup.isActive = isActive;
lookup.statuses = statuses; lookup.statusIds = statusIds;
lookup.project = { lookup.project = {
fields: [ fields: [
nameof<Plan>(x => x.id), nameof<Plan>(x => x.id),

View File

@ -19,6 +19,7 @@ import { DescriptionTemplatesInSection, PlanBlueprint, PlanBlueprintDefinition,
import { TenantLookup } from '@app/core/query/tenant.lookup'; import { TenantLookup } from '@app/core/query/tenant.lookup';
import { Tenant } from '@app/core/model/tenant/tenant'; import { Tenant } from '@app/core/model/tenant/tenant';
import { AuthService } from '@app/core/services/auth/auth.service'; import { AuthService } from '@app/core/services/auth/auth.service';
import { PlanStatusLookup } from '@app/core/query/plan-status.lookup';
@Component({ @Component({
selector: 'description-copy-dialog-component', selector: 'description-copy-dialog-component',
@ -49,7 +50,9 @@ export class DescriptionCopyDialogComponent {
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
if (ids && ids.length > 0) { lookup.ids = ids; } if (ids && ids.length > 0) { lookup.ids = ids; }
lookup.isActive = [IsActive.Active]; lookup.isActive = [IsActive.Active];
lookup.statuses = [PlanStatusEnum.Draft]; const planStatusLookup: PlanStatusLookup = new PlanStatusLookup();
planStatusLookup.internalStatuses = [PlanStatusEnum.Draft];
lookup.planStatusSubQuery = planStatusLookup;
lookup.project = { lookup.project = {
fields: [ fields: [
nameof<Plan>(x => x.id), nameof<Plan>(x => x.id),

View File

@ -67,7 +67,7 @@
<button [disabled]="saving" mat-menu-item (click)="saveAndClose()" type="button">{{ 'DESCRIPTION-EDITOR.ACTIONS.SAVE-AND-CLOSE' | translate }}</button> <button [disabled]="saving" mat-menu-item (click)="saveAndClose()" type="button">{{ 'DESCRIPTION-EDITOR.ACTIONS.SAVE-AND-CLOSE' | translate }}</button>
<button [disabled]="saving" mat-menu-item (click)="saveAndContinue()" type="button">{{ 'DESCRIPTION-EDITOR.ACTIONS.SAVE-AND-CONTINUE' | translate }}</button> <button [disabled]="saving" mat-menu-item (click)="saveAndContinue()" type="button">{{ 'DESCRIPTION-EDITOR.ACTIONS.SAVE-AND-CONTINUE' | translate }}</button>
</mat-menu> </mat-menu>
<ng-container *ngIf="availableStatusesTransitions && availableStatusesTransitions.length > 0 && !isLocked && item.id"> <ng-container *ngIf="availableStatusesTransitions && availableStatusesTransitions.length > 0 && !isLocked && item.id && isNotFinalizedPlan()">
<button *ngFor='let status of availableStatusesTransitions' [disabled]="saving" mat-button class="rounded-btn neutral mr-2" type="button" (click)="persistStatus(status)">{{ status.name }}</button> <button *ngFor='let status of availableStatusesTransitions' [disabled]="saving" mat-button class="rounded-btn neutral mr-2" type="button" (click)="persistStatus(status)">{{ status.name }}</button>
</ng-container> </ng-container>
<button [disabled]="saving" *ngIf="isLocked" mat-button disabled class="rounded-btn neutral cursor-default" type="button">{{ 'PLAN-OVERVIEW.LOCKED' | translate}}</button> <button [disabled]="saving" *ngIf="isLocked" mat-button disabled class="rounded-btn neutral cursor-default" type="button">{{ 'PLAN-OVERVIEW.LOCKED' | translate}}</button>

View File

@ -581,6 +581,10 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
} }
} }
isNotFinalizedPlan(): boolean {
return this.item.plan?.status?.internalStatus != PlanStatusEnum.Finalized;
}
descriptionInfoValid(): boolean { descriptionInfoValid(): boolean {
return this.formGroup.get('label') && this.formGroup.get('label').valid && this.formGroup.get('descriptionTemplateId') && this.formGroup.get('descriptionTemplateId').valid; return this.formGroup.get('label') && this.formGroup.get('label').valid && this.formGroup.get('descriptionTemplateId') && this.formGroup.get('descriptionTemplateId').valid;
} }

View File

@ -97,7 +97,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
return this.listingItems != null && this.listingItems.length > 0; return this.listingItems != null && this.listingItems.length > 0;
} }
get hasFilters(): boolean { get hasFilters(): boolean {
return (this.lookup.like != null && this.lookup.like != '') || this.lookup.statuses != null || return (this.lookup.like != null && this.lookup.like != '') || this.lookup.statusIds != null ||
this.lookup.planSubQuery != null || this.lookup.descriptionTemplateSubQuery != null || this.lookup.planSubQuery != null || this.lookup.descriptionTemplateSubQuery != null ||
this.lookup.descriptionTagSubQuery != null || this.lookup.descriptionReferenceSubQuery != null || this.lookup.descriptionTagSubQuery != null || this.lookup.descriptionReferenceSubQuery != null ||
this.lookup.tenantSubQuery != null; this.lookup.tenantSubQuery != null;
@ -415,7 +415,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
} }
_patchLookupFromFilters(filters: DescriptionListingFilters): DescriptionLookup { _patchLookupFromFilters(filters: DescriptionListingFilters): DescriptionLookup {
this.lookup.statuses = filters?.status != null ? [filters?.status] : null; this.lookup.statusIds = filters?.statusId != null ? [filters?.statusId] : null;
// Tenants // Tenants
let viewOnlyTenant = filters?.viewOnlyTenant ?? false; let viewOnlyTenant = filters?.viewOnlyTenant ?? false;
@ -474,7 +474,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
private _countFilters(lookup: DescriptionLookup): number { private _countFilters(lookup: DescriptionLookup): number {
let count = 0; let count = 0;
if (lookup.statuses) count += lookup.statuses.length; if (lookup.statusIds) count += lookup.statusIds.length;
if (lookup.tenantSubQuery) count += 1; if (lookup.tenantSubQuery) count += 1;
if (lookup.descriptionTemplateSubQuery) count += lookup.descriptionTemplateSubQuery.ids?.length; if (lookup.descriptionTemplateSubQuery) count += lookup.descriptionTemplateSubQuery.ids?.length;
if (lookup.descriptionTagSubQuery) count += lookup.descriptionTagSubQuery.tagIds?.length; if (lookup.descriptionTagSubQuery) count += lookup.descriptionTagSubQuery.tagIds?.length;

View File

@ -47,7 +47,7 @@ export class DescriptionFilterDialogComponent implements OnInit {
private _buildDescriptionFilters(lookup: DescriptionLookup, references: ReferencesWithType[]): DescriptionListingFilters { private _buildDescriptionFilters(lookup: DescriptionLookup, references: ReferencesWithType[]): DescriptionListingFilters {
return { return {
status: lookup.statuses?.[0] ?? null, statusId: lookup.statusIds?.[0] ?? null,
viewOnlyTenant: lookup.tenantSubQuery?.codes?.length > 0, viewOnlyTenant: lookup.tenantSubQuery?.codes?.length > 0,
role: lookup.planSubQuery?.planUserSubQuery?.userRoles?.[0] ?? null, role: lookup.planSubQuery?.planUserSubQuery?.userRoles?.[0] ?? null,
descriptionTemplates: lookup.descriptionTemplateSubQuery?.ids ?? [], descriptionTemplates: lookup.descriptionTemplateSubQuery?.ids ?? [],

View File

@ -11,12 +11,10 @@
<!-- Status Filter--> <!-- Status Filter-->
<div class="col-10" *ngIf="!isPublic"> <div class="col-10" *ngIf="!isPublic">
<h6 class="category-title">{{ 'DESCRIPTION-LISTING.FILTERS.STATUS.NAME' | translate}}</h6> <h6 class="category-title">{{ 'DESCRIPTION-LISTING.FILTERS.STATUS.NAME' | translate}}</h6>
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('status')" class="row"> <mat-form-field class="w-100">
<mat-radio-button [value]="null" [checked]="formGroup.get('status')?.value == null" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.STATUS.TYPES.ANY' | translate }}</mat-radio-button> <mat-label>{{'DESCRIPTION-LISTING.FILTERS.STATUS.PLACEHOLDER' | translate }}</mat-label>
<mat-radio-button [value]="statuses.Draft" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.STATUS.TYPES.DRAFT' | translate }}</mat-radio-button> <app-single-auto-complete [formControl]="formGroup.get('statusId')" [configuration]="descriptionStatusAutocompleteConfiguration"></app-single-auto-complete>
<mat-radio-button [value]="statuses.Finalized" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.STATUS.TYPES.FINALIZED' | translate }}</mat-radio-button> </mat-form-field>
<mat-radio-button [value]="statuses.Canceled" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.STATUS.TYPES.CANCELED' | translate }}</mat-radio-button>
</mat-radio-group>
<hr> <hr>
</div> </div>
<!-- End of Status Filter--> <!-- End of Status Filter-->

View File

@ -8,6 +8,7 @@ import { Reference } from '@app/core/model/reference/reference';
import { ReferencesWithType } from '@app/core/query/description.lookup'; import { ReferencesWithType } from '@app/core/query/description.lookup';
import { ReferenceLookup } from '@app/core/query/reference.lookup'; import { ReferenceLookup } from '@app/core/query/reference.lookup';
import { AuthService } from '@app/core/services/auth/auth.service'; import { AuthService } from '@app/core/services/auth/auth.service';
import { DescriptionStatusService } from '@app/core/services/description-status/description-status.service';
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
import { PlanService } from '@app/core/services/plan/plan.service'; import { PlanService } from '@app/core/services/plan/plan.service';
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service'; import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
@ -57,6 +58,7 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent<Descriptio
planAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = this.planService.multipleAutocompleteConfiguration; planAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = this.planService.multipleAutocompleteConfiguration;
tagAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = this.tagService.multipleAutocompleteConfiguration; tagAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = this.tagService.multipleAutocompleteConfiguration;
referenceTypeAutocompleteConfiguration: SingleAutoCompleteConfiguration = this.getReferenceTypeAutocompleteConfiguration(); referenceTypeAutocompleteConfiguration: SingleAutoCompleteConfiguration = this.getReferenceTypeAutocompleteConfiguration();
descriptionStatusAutocompleteConfiguration: SingleAutoCompleteConfiguration = this.descriptionStatusService.singleAutocompleteConfiguration;
referenceAutocompleteConfiguration: Map<Guid, MultipleAutoCompleteConfiguration>; referenceAutocompleteConfiguration: Map<Guid, MultipleAutoCompleteConfiguration>;
constructor( constructor(
@ -67,6 +69,7 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent<Descriptio
private tagService: TagService, private tagService: TagService,
private referenceService: ReferenceService, private referenceService: ReferenceService,
private referenceTypeService: ReferenceTypeService, private referenceTypeService: ReferenceTypeService,
private descriptionStatusService: DescriptionStatusService
) { ) {
super(new ValidationErrorModel()); super(new ValidationErrorModel());
} }
@ -77,7 +80,7 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent<Descriptio
buildForm(filters: DescriptionListingFilters) { buildForm(filters: DescriptionListingFilters) {
this.formGroup = new FormGroup<DescriptionListingFilterForm>({ this.formGroup = new FormGroup<DescriptionListingFilterForm>({
status: new FormControl(filters?.status), statusId: new FormControl(filters?.statusId),
viewOnlyTenant: new FormControl(filters.viewOnlyTenant), viewOnlyTenant: new FormControl(filters.viewOnlyTenant),
role: new FormControl(filters.role), role: new FormControl(filters.role),
descriptionTemplates: new FormControl(filters.descriptionTemplates), descriptionTemplates: new FormControl(filters.descriptionTemplates),
@ -110,7 +113,7 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent<Descriptio
resetFilters() { resetFilters() {
this.formGroup.reset(); this.formGroup.reset();
this.formGroup.patchValue({ this.formGroup.patchValue({
status: null, statusId: null,
viewOnlyTenant: null, viewOnlyTenant: null,
role: null, role: null,
descriptionTemplates: null, descriptionTemplates: null,
@ -209,7 +212,7 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent<Descriptio
} }
export interface DescriptionListingFilters { export interface DescriptionListingFilters {
status: DescriptionStatusEnum, statusId: Guid,
viewOnlyTenant: boolean, viewOnlyTenant: boolean,
role: Guid, role: Guid,
descriptionTemplates: Guid[], descriptionTemplates: Guid[],
@ -219,7 +222,7 @@ export interface DescriptionListingFilters {
} }
interface DescriptionListingFilterForm { interface DescriptionListingFilterForm {
status: FormControl<DescriptionStatusEnum>, statusId: FormControl<Guid>,
viewOnlyTenant: FormControl<boolean>, viewOnlyTenant: FormControl<boolean>,
role: FormControl<Guid>, role: FormControl<Guid>,
descriptionTemplates: FormControl<Guid[]>, descriptionTemplates: FormControl<Guid[]>,

View File

@ -13,18 +13,18 @@
</div> </div>
</div> </div>
</div> </div>
<div *ngIf="description.status.internalStatus === descriptionStatusEnum.Finalized" class="col-auto description-title">{{description.label}}</div> <div *ngIf="description.status?.internalStatus === descriptionStatusEnum.Finalized" class="col-auto description-title">{{description.label}}</div>
<div *ngIf="description.status.internalStatus === descriptionStatusEnum.Draft" class="col-auto description-title-draft">{{description.label}}</div> <div *ngIf="description.status?.internalStatus === descriptionStatusEnum.Draft" class="col-auto description-title-draft">{{description.label}}</div>
<div *ngIf="description.status.internalStatus === descriptionStatusEnum.Canceled" class="col-auto description-title-draft">{{description.label}}</div> <div *ngIf="description.status?.internalStatus === descriptionStatusEnum.Canceled" class="col-auto description-title-draft">{{description.label}}</div>
<div *ngIf="description.status.internalStatus === null" class="col-auto description-title-draft">{{description.label}}</div> <div *ngIf="description.status?.internalStatus === null" class="col-auto description-title-draft">{{description.label}}</div>
<div class="description-subtitle"> <div class="description-subtitle">
<span *ngIf="isUserPlanRelated()" class="col-auto">{{ enumUtils.toPlanUserRolesString(planService.getCurrentUserRolesInPlan(description?.plan?.planUsers)) }}</span> <span *ngIf="isUserPlanRelated()" class="col-auto">{{ enumUtils.toPlanUserRolesString(planService.getCurrentUserRolesInPlan(description?.plan?.planUsers)) }}</span>
<span *ngIf="isUserPlanRelated()">.</span> <span *ngIf="isUserPlanRelated()">.</span>
<span class="col-auto" *ngIf="description.status.internalStatus === descriptionStatusEnum.Finalized && description.plan.accessType === planAccessTypeEnum.Public"><span class="material-icons icon-align">public</span>{{'DESCRIPTION-LISTING.STATES.PUBLIC' | translate}}</span> <span class="col-auto" *ngIf="description.status?.internalStatus === descriptionStatusEnum.Finalized && description.plan.accessType === planAccessTypeEnum.Public"><span class="material-icons icon-align">public</span>{{'DESCRIPTION-LISTING.STATES.PUBLIC' | translate}}</span>
<span *ngIf="description.status.internalStatus === descriptionStatusEnum.Finalized && description.plan.accessType != planAccessTypeEnum.Public; else draft" class="col-auto"><span class="material-icons icon-align">done</span>{{ description.status.name }}</span> <span *ngIf="description.status?.internalStatus === descriptionStatusEnum.Finalized && description.plan.accessType != planAccessTypeEnum.Public; else draft" class="col-auto"><span class="material-icons icon-align">done</span>{{ description.status.name }}</span>
<ng-template #draft><span *ngIf="description.status.internalStatus === descriptionStatusEnum.Draft && canEditDescription(); else preview" class=" col-auto draft"><span class="material-icons icon-align">create</span>{{ description.status.name }}</span></ng-template> <ng-template #draft><span *ngIf="description.status?.internalStatus === descriptionStatusEnum.Draft && canEditDescription(); else preview" class=" col-auto draft"><span class="material-icons icon-align">create</span>{{ description.status.name }}</span></ng-template>
<ng-template #preview><span *ngIf="description.status.internalStatus === descriptionStatusEnum.Draft && !canEditDescription(); else otherStatus" class=" col-auto draft"><span class="material-icons-outlined mr-1 icon-align">visibility</span>{{ description.status.name }}</span></ng-template> <ng-template #preview><span *ngIf="description.status?.internalStatus === descriptionStatusEnum.Draft && !canEditDescription(); else otherStatus" class=" col-auto draft"><span class="material-icons-outlined mr-1 icon-align">visibility</span>{{ description.status.name }}</span></ng-template>
<ng-template #otherStatus><span *ngIf="!isPublic" class=" col-auto draft">{{ description.status.name }}</span></ng-template> <ng-template #otherStatus><span *ngIf="!isPublic" class=" col-auto draft">{{ description.status?.name }}</span></ng-template>
<span>.</span> <span>.</span>
<span class="col">{{'DESCRIPTION-LISTING.GRANT' | translate}}: {{referenceService.getReferencesForTypesFirstSafe(description?.plan?.planReferences, [this.referenceTypeService.getGrantReferenceType()])?.reference?.label}}</span> <span class="col">{{'DESCRIPTION-LISTING.GRANT' | translate}}: {{referenceService.getReferencesForTypesFirstSafe(description?.plan?.planReferences, [this.referenceTypeService.getGrantReferenceType()])?.reference?.label}}</span>
</div> </div>

View File

@ -134,7 +134,7 @@
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="frame mb-3 pt-4 pl-4 pr-5 pb-3"> <div class="frame mb-3 pt-4 pl-4 pr-5 pb-3">
<ng-container *ngIf="availableStatusesTransitions && availableStatusesTransitions.length > 0 && !isLocked"> <ng-container *ngIf="availableStatusesTransitions && availableStatusesTransitions.length > 0 && !isLocked && isNotFinalizedPlan(description)">
<div *ngFor='let status of availableStatusesTransitions'> <div *ngFor='let status of availableStatusesTransitions'>
<div class="row align-items-center" (click)="persistStatus(status, description)"> <div class="row align-items-center" (click)="persistStatus(status, description)">
<div class="col-auto pr-0"> <div class="col-auto pr-0">

View File

@ -319,6 +319,10 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
return description?.status?.internalStatus != DescriptionStatusEnum.Finalized; return description?.status?.internalStatus != DescriptionStatusEnum.Finalized;
} }
isNotFinalizedPlan(description: Description) {
return description?.plan?.status?.internalStatus != PlanStatusEnum.Finalized;
}
editClicked(description: Description) { editClicked(description: Description) {
this.router.navigate([this.routerUtils.generateUrl(['/descriptions/edit/', description.id.toString()])]); this.router.navigate([this.routerUtils.generateUrl(['/descriptions/edit/', description.id.toString()])]);
} }

View File

@ -19,6 +19,7 @@ import { nameof } from 'ts-simple-nameof';
import { AuthService } from '@app/core/services/auth/auth.service'; import { AuthService } from '@app/core/services/auth/auth.service';
import { TenantLookup } from '@app/core/query/tenant.lookup'; import { TenantLookup } from '@app/core/query/tenant.lookup';
import { Tenant } from '@app/core/model/tenant/tenant'; import { Tenant } from '@app/core/model/tenant/tenant';
import { PlanStatusLookup } from '@app/core/query/plan-status.lookup';
@Component({ @Component({
selector: 'app-start-new-description-dialog', selector: 'app-start-new-description-dialog',
@ -41,13 +42,15 @@ export class StartNewDescriptionDialogComponent extends BaseComponent {
valueAssign: (item: Plan) => item.id, valueAssign: (item: Plan) => item.id,
}; };
private buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[], statuses?: PlanStatusEnum[], planDescriptionTemplateSubQuery?: PlanDescriptionTemplateLookup): PlanLookup { private buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[], planDescriptionTemplateSubQuery?: PlanDescriptionTemplateLookup): PlanLookup {
const lookup: PlanLookup = new PlanLookup(); const lookup: PlanLookup = new PlanLookup();
lookup.page = { size: 100, offset: 0 }; lookup.page = { size: 100, offset: 0 };
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
if (ids && ids.length > 0) { lookup.ids = ids; } if (ids && ids.length > 0) { lookup.ids = ids; }
lookup.isActive = [IsActive.Active]; lookup.isActive = [IsActive.Active];
lookup.statuses = [PlanStatusEnum.Draft]; const planStatusLookup: PlanStatusLookup = new PlanStatusLookup();
planStatusLookup.internalStatuses = [PlanStatusEnum.Draft];
lookup.planStatusSubQuery = planStatusLookup;
lookup.project = { lookup.project = {
fields: [ fields: [
nameof<Plan>(x => x.id), nameof<Plan>(x => x.id),

View File

@ -35,7 +35,7 @@ export class PlanFilterDialogComponent implements OnInit {
private _buildPlanFilters(lookup: PlanLookup, references: ReferencesWithType[]): PlanListingFilters { private _buildPlanFilters(lookup: PlanLookup, references: ReferencesWithType[]): PlanListingFilters {
return { return {
status: lookup.statuses?.[0] ?? null, statusId: lookup.statusIds?.[0] ?? null,
viewOnlyTenant: lookup.tenantSubQuery?.codes?.length > 0, viewOnlyTenant: lookup.tenantSubQuery?.codes?.length > 0,
descriptionTemplates: lookup.planDescriptionTemplateSubQuery?.descriptionTemplateGroupIds ? lookup.planDescriptionTemplateSubQuery?.descriptionTemplateGroupIds : [], descriptionTemplates: lookup.planDescriptionTemplateSubQuery?.descriptionTemplateGroupIds ? lookup.planDescriptionTemplateSubQuery?.descriptionTemplateGroupIds : [],
planBlueprints: lookup.planBlueprintSubQuery?.ids ?? [], planBlueprints: lookup.planBlueprintSubQuery?.ids ?? [],

View File

@ -9,11 +9,10 @@
<!-- Visibility Filter--> <!-- Visibility Filter-->
<div *ngIf="!isPublic" class="col-10"> <div *ngIf="!isPublic" class="col-10">
<h6 class="category-title">{{ 'PLAN-LISTING.FILTERS.STATUS.NAME' | translate }}</h6> <h6 class="category-title">{{ 'PLAN-LISTING.FILTERS.STATUS.NAME' | translate }}</h6>
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('status')" class="row"> <mat-form-field class="w-100">
<mat-radio-button [value]="null" [checked]="formGroup.get('status')?.value == null" class="col-12">{{ 'PLAN-LISTING.FILTERS.STATUS.TYPE.ANY' | translate }}</mat-radio-button> <mat-label>{{'PLAN-LISTING.FILTERS.STATUS.PLACEHOLDER' | translate }}</mat-label>
<mat-radio-button [value]="status.Draft" class="col-12">{{ 'PLAN-LISTING.FILTERS.STATUS.TYPE.DRAFT' | translate }}</mat-radio-button> <app-single-auto-complete [formControl]="formGroup.get('statusId')" [configuration]="planStatusAutoCompleteConfiguration"></app-single-auto-complete>
<mat-radio-button [value]="status.Finalized" class="col-12">{{ 'PLAN-LISTING.FILTERS.STATUS.TYPE.FINALIZED' | translate }}</mat-radio-button> </mat-form-field>
</mat-radio-group>
<hr> <hr>
</div> </div>
<!-- End of Visibility Filter--> <!-- End of Visibility Filter-->

View File

@ -21,6 +21,7 @@ import { Reference } from '@app/core/model/reference/reference';
import { ReferenceType } from '@app/core/model/reference-type/reference-type'; import { ReferenceType } from '@app/core/model/reference-type/reference-type';
import { QueryResult } from '@common/model/query-result'; import { QueryResult } from '@common/model/query-result';
import { ReferencesWithType } from '@app/core/query/description.lookup'; import { ReferencesWithType } from '@app/core/query/description.lookup';
import { PlanStatusService } from '@app/core/services/plan/plan-status.service';
@Component({ @Component({
selector: 'app-plan-filter-component', selector: 'app-plan-filter-component',
@ -56,6 +57,7 @@ export class PlanFilterComponent extends BaseCriteriaComponent<PlanListingFilter
planBlueprintAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = this.planBlueprintService.multipleAutocompleteConfiguration; planBlueprintAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = this.planBlueprintService.multipleAutocompleteConfiguration;
referenceTypeAutocompleteConfiguration: SingleAutoCompleteConfiguration = this.getReferenceTypeAutocompleteConfiguration(); referenceTypeAutocompleteConfiguration: SingleAutoCompleteConfiguration = this.getReferenceTypeAutocompleteConfiguration();
referenceAutocompleteConfiguration: Map<Guid, MultipleAutoCompleteConfiguration>; referenceAutocompleteConfiguration: Map<Guid, MultipleAutoCompleteConfiguration>;
planStatusAutoCompleteConfiguration: SingleAutoCompleteConfiguration = this.planStatusService.singleAutocompleteConfiguration;
constructor( constructor(
public language: TranslateService, public language: TranslateService,
@ -65,6 +67,7 @@ export class PlanFilterComponent extends BaseCriteriaComponent<PlanListingFilter
private planBlueprintService: PlanBlueprintService, private planBlueprintService: PlanBlueprintService,
private referenceTypeService: ReferenceTypeService, private referenceTypeService: ReferenceTypeService,
private referenceService: ReferenceService, private referenceService: ReferenceService,
private planStatusService: PlanStatusService
) { ) {
super(new ValidationErrorModel()); super(new ValidationErrorModel());
} }
@ -75,7 +78,7 @@ export class PlanFilterComponent extends BaseCriteriaComponent<PlanListingFilter
buildForm(filters: PlanListingFilters){ buildForm(filters: PlanListingFilters){
this.formGroup = new FormGroup<PlanListingFilterForm>({ this.formGroup = new FormGroup<PlanListingFilterForm>({
status: new FormControl(filters?.status), statusId: new FormControl(filters?.statusId),
descriptionTemplates: new FormControl(filters?.descriptionTemplates), descriptionTemplates: new FormControl(filters?.descriptionTemplates),
planBlueprints: new FormControl(filters?.planBlueprints), planBlueprints: new FormControl(filters?.planBlueprints),
role: new FormControl(filters?.role), role: new FormControl(filters?.role),
@ -110,7 +113,7 @@ export class PlanFilterComponent extends BaseCriteriaComponent<PlanListingFilter
planBlueprints: null, planBlueprints: null,
references: null, references: null,
role: null, role: null,
status: null, statusId: null,
viewOnlyTenant: null viewOnlyTenant: null
}); });
this.referenceAutocompleteConfiguration.clear(); this.referenceAutocompleteConfiguration.clear();
@ -208,7 +211,7 @@ export class PlanFilterComponent extends BaseCriteriaComponent<PlanListingFilter
} }
export interface PlanListingFilters { export interface PlanListingFilters {
status: PlanStatusEnum, statusId: Guid,
viewOnlyTenant: boolean, viewOnlyTenant: boolean,
descriptionTemplates: Guid[], descriptionTemplates: Guid[],
planBlueprints: Guid[], planBlueprints: Guid[],
@ -217,7 +220,7 @@ export interface PlanListingFilters {
} }
interface PlanListingFilterForm { interface PlanListingFilterForm {
status: FormControl<PlanStatusEnum>, statusId: FormControl<Guid>,
viewOnlyTenant: FormControl<boolean>, viewOnlyTenant: FormControl<boolean>,
descriptionTemplates: FormControl<Guid[]>, descriptionTemplates: FormControl<Guid[]>,
planBlueprints: FormControl<Guid[]>, planBlueprints: FormControl<Guid[]>,

View File

@ -97,7 +97,7 @@ export class PlanListingComponent extends BaseListingComponent<BasePlan, PlanLoo
return this.listingItems != null && this.listingItems.length > 0; return this.listingItems != null && this.listingItems.length > 0;
} }
get hasFilters(): boolean { get hasFilters(): boolean {
return (this.lookup.like != null && this.lookup.like != '') || this.lookup.statuses != null || return (this.lookup.like != null && this.lookup.like != '') || this.lookup.statusIds != null ||
this.lookup.planReferenceSubQuery != null || this.lookup.planDescriptionTemplateSubQuery != null || this.lookup.planReferenceSubQuery != null || this.lookup.planDescriptionTemplateSubQuery != null ||
this.lookup.planBlueprintSubQuery != null || this.lookup.planUserSubQuery != null || this.lookup.planBlueprintSubQuery != null || this.lookup.planUserSubQuery != null ||
this.lookup.tenantSubQuery != null; this.lookup.tenantSubQuery != null;
@ -415,7 +415,7 @@ export class PlanListingComponent extends BaseListingComponent<BasePlan, PlanLoo
private _patchLookupFromFilters(filters: PlanListingFilters): PlanLookup { private _patchLookupFromFilters(filters: PlanListingFilters): PlanLookup {
this.lookup.statuses = filters?.status != null ? [filters.status] : null; this.lookup.statusIds = filters?.statusId != null ? [filters.statusId] : null;
// Tenants // Tenants
let viewOnlyTenant = filters?.viewOnlyTenant ?? false; let viewOnlyTenant = filters?.viewOnlyTenant ?? false;
@ -472,7 +472,7 @@ export class PlanListingComponent extends BaseListingComponent<BasePlan, PlanLoo
private _countFilters(lookup: PlanLookup): number { private _countFilters(lookup: PlanLookup): number {
let count = 0; let count = 0;
if (lookup.statuses) count += lookup.statuses.length; if (lookup.statusIds) count += lookup.statusIds.length;
if (lookup.tenantSubQuery) count += 1; if (lookup.tenantSubQuery) count += 1;
if (lookup.planDescriptionTemplateSubQuery) count += lookup.planDescriptionTemplateSubQuery.descriptionTemplateGroupIds?.length; if (lookup.planDescriptionTemplateSubQuery) count += lookup.planDescriptionTemplateSubQuery.descriptionTemplateGroupIds?.length;
if (lookup.planBlueprintSubQuery) count += lookup.planBlueprintSubQuery.ids?.length; if (lookup.planBlueprintSubQuery) count += lookup.planBlueprintSubQuery.ids?.length;

View File

@ -770,6 +770,7 @@
"NO-ITEMS-FOUND": "Your search didn't match any items.", "NO-ITEMS-FOUND": "Your search didn't match any items.",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPE": { "TYPE": {
"ANY": "Any", "ANY": "Any",
"PUBLIC": "Published", "PUBLIC": "Published",
@ -1065,6 +1066,7 @@
"RESET-FILTERS": "Reset", "RESET-FILTERS": "Reset",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPES": { "TYPES": {
"ANY": "Any", "ANY": "Any",
"DRAFT": "Draft", "DRAFT": "Draft",

View File

@ -770,6 +770,7 @@
"NO-ITEMS-FOUND": "Your search didn't match any items.", "NO-ITEMS-FOUND": "Your search didn't match any items.",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPE": { "TYPE": {
"ANY": "Any", "ANY": "Any",
"PUBLIC": "Published", "PUBLIC": "Published",
@ -1065,6 +1066,7 @@
"RESET-FILTERS": "Reset", "RESET-FILTERS": "Reset",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPES": { "TYPES": {
"ANY": "Any", "ANY": "Any",
"DRAFT": "Draft", "DRAFT": "Draft",

View File

@ -768,6 +768,7 @@
"NO-ITEMS-FOUND": "Your search didn't match any items.", "NO-ITEMS-FOUND": "Your search didn't match any items.",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPE": { "TYPE": {
"ANY": "Any", "ANY": "Any",
"PUBLIC": "Published", "PUBLIC": "Published",
@ -1063,6 +1064,7 @@
"RESET-FILTERS": "Reset", "RESET-FILTERS": "Reset",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPES": { "TYPES": {
"ANY": "Any", "ANY": "Any",
"DRAFT": "Draft", "DRAFT": "Draft",

View File

@ -770,6 +770,7 @@
"NO-ITEMS-FOUND": "Your search didn't match any items.", "NO-ITEMS-FOUND": "Your search didn't match any items.",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPE": { "TYPE": {
"ANY": "Any", "ANY": "Any",
"PUBLIC": "Published", "PUBLIC": "Published",
@ -1065,6 +1066,7 @@
"RESET-FILTERS": "Reset", "RESET-FILTERS": "Reset",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPES": { "TYPES": {
"ANY": "Any", "ANY": "Any",
"DRAFT": "Draft", "DRAFT": "Draft",

View File

@ -770,6 +770,7 @@
"NO-ITEMS-FOUND": "Your search didn't match any items.", "NO-ITEMS-FOUND": "Your search didn't match any items.",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPE": { "TYPE": {
"ANY": "Any", "ANY": "Any",
"PUBLIC": "Published", "PUBLIC": "Published",
@ -1065,6 +1066,7 @@
"RESET-FILTERS": "Reset", "RESET-FILTERS": "Reset",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPES": { "TYPES": {
"ANY": "Any", "ANY": "Any",
"DRAFT": "Draft", "DRAFT": "Draft",

View File

@ -770,6 +770,7 @@
"NO-ITEMS-FOUND": "Your search didn't match any items.", "NO-ITEMS-FOUND": "Your search didn't match any items.",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPE": { "TYPE": {
"ANY": "Any", "ANY": "Any",
"PUBLIC": "Published", "PUBLIC": "Published",
@ -1065,6 +1066,7 @@
"RESET-FILTERS": "Reset", "RESET-FILTERS": "Reset",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPES": { "TYPES": {
"ANY": "Any", "ANY": "Any",
"DRAFT": "Draft", "DRAFT": "Draft",

View File

@ -770,6 +770,7 @@
"NO-ITEMS-FOUND": "Your search didn't match any items.", "NO-ITEMS-FOUND": "Your search didn't match any items.",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPE": { "TYPE": {
"ANY": "Any", "ANY": "Any",
"PUBLIC": "Published", "PUBLIC": "Published",
@ -1065,6 +1066,7 @@
"RESET-FILTERS": "Reset", "RESET-FILTERS": "Reset",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPES": { "TYPES": {
"ANY": "Any", "ANY": "Any",
"DRAFT": "Draft", "DRAFT": "Draft",

View File

@ -770,6 +770,7 @@
"NO-ITEMS-FOUND": "Your search didn't match any items.", "NO-ITEMS-FOUND": "Your search didn't match any items.",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPE": { "TYPE": {
"ANY": "Any", "ANY": "Any",
"PUBLIC": "Published", "PUBLIC": "Published",
@ -1065,6 +1066,7 @@
"RESET-FILTERS": "Reset", "RESET-FILTERS": "Reset",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPES": { "TYPES": {
"ANY": "Any", "ANY": "Any",
"DRAFT": "Draft", "DRAFT": "Draft",

View File

@ -770,6 +770,7 @@
"NO-ITEMS-FOUND": "Your search didn't match any items.", "NO-ITEMS-FOUND": "Your search didn't match any items.",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPE": { "TYPE": {
"ANY": "Any", "ANY": "Any",
"PUBLIC": "Published", "PUBLIC": "Published",
@ -1065,6 +1066,7 @@
"RESET-FILTERS": "Reset", "RESET-FILTERS": "Reset",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPES": { "TYPES": {
"ANY": "Any", "ANY": "Any",
"DRAFT": "Draft", "DRAFT": "Draft",

View File

@ -770,6 +770,7 @@
"NO-ITEMS-FOUND": "Your search didn't match any items.", "NO-ITEMS-FOUND": "Your search didn't match any items.",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPE": { "TYPE": {
"ANY": "Any", "ANY": "Any",
"PUBLIC": "Published", "PUBLIC": "Published",
@ -1065,6 +1066,7 @@
"RESET-FILTERS": "Reset", "RESET-FILTERS": "Reset",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPES": { "TYPES": {
"ANY": "Any", "ANY": "Any",
"DRAFT": "Draft", "DRAFT": "Draft",

View File

@ -770,6 +770,7 @@
"NO-ITEMS-FOUND": "Your search didn't match any items.", "NO-ITEMS-FOUND": "Your search didn't match any items.",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPE": { "TYPE": {
"ANY": "Any", "ANY": "Any",
"PUBLIC": "Published", "PUBLIC": "Published",
@ -1065,6 +1066,7 @@
"RESET-FILTERS": "Reset", "RESET-FILTERS": "Reset",
"STATUS": { "STATUS": {
"NAME": "Status", "NAME": "Status",
"PLACEHOLDER":"Select Status",
"TYPES": { "TYPES": {
"ANY": "Any", "ANY": "Any",
"DRAFT": "Draft", "DRAFT": "Draft",