add plan/description status sub queries, add elastic status field, ui fixes
This commit is contained in:
parent
e4567b8b75
commit
1c60bdf77b
|
@ -10,14 +10,14 @@ public class RecentActivityItemEntity {
|
|||
private UUID id;
|
||||
private Instant updatedAt;
|
||||
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.id = id;
|
||||
this.updatedAt = updatedAt;
|
||||
this.label = label;
|
||||
this.statusValue = statusValue;
|
||||
this.statusId = statusId;
|
||||
}
|
||||
|
||||
public RecentActivityItemType getType() {
|
||||
|
@ -52,11 +52,11 @@ public class RecentActivityItemEntity {
|
|||
this.label = label;
|
||||
}
|
||||
|
||||
public Short getStatusValue() {
|
||||
return statusValue;
|
||||
public UUID getStatusId() {
|
||||
return statusId;
|
||||
}
|
||||
|
||||
public void setStatusValue(Short statusValue) {
|
||||
this.statusValue = statusValue;
|
||||
public void setStatusId(UUID statusId) {
|
||||
this.statusId = statusId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,9 +33,9 @@ public class DescriptionElasticEntity {
|
|||
private String description;
|
||||
public final static String _description = "description";
|
||||
|
||||
@Field(value = DescriptionElasticEntity._status, type = FieldType.Short)
|
||||
private DescriptionStatus status;
|
||||
public final static String _status = "status";
|
||||
@Field(value = DescriptionElasticEntity._statusId, type = FieldType.Keyword)
|
||||
private UUID statusId;
|
||||
public final static String _statusId = "statusId";
|
||||
|
||||
@Field(value = DescriptionElasticEntity._finalizedAt, type = FieldType.Date)
|
||||
private Date finalizedAt;
|
||||
|
@ -97,12 +97,12 @@ public class DescriptionElasticEntity {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public DescriptionStatus getStatus() {
|
||||
return this.status;
|
||||
public UUID getStatusId() {
|
||||
return statusId;
|
||||
}
|
||||
|
||||
public void setStatus(DescriptionStatus status) {
|
||||
this.status = status;
|
||||
public void setStatusId(UUID statusId) {
|
||||
this.statusId = statusId;
|
||||
}
|
||||
|
||||
public Date getFinalizedAt() {
|
||||
|
|
|
@ -35,9 +35,9 @@ public class PlanElasticEntity {
|
|||
private Short version;
|
||||
public final static String _version = "version";
|
||||
|
||||
@Field(value = PlanElasticEntity._status, type = FieldType.Short)
|
||||
private PlanStatus status;
|
||||
public final static String _status = "status";
|
||||
@Field(value = PlanElasticEntity._statusId, type = FieldType.Keyword)
|
||||
private UUID statusId;
|
||||
public final static String _statusId = "statusId";
|
||||
|
||||
@Field(value = PlanElasticEntity._accessType, type = FieldType.Short)
|
||||
private PlanAccessType accessType;
|
||||
|
@ -130,12 +130,12 @@ public class PlanElasticEntity {
|
|||
this.version = version;
|
||||
}
|
||||
|
||||
public PlanStatus getStatus() {
|
||||
return this.status;
|
||||
public UUID getStatusId() {
|
||||
return statusId;
|
||||
}
|
||||
|
||||
public void setStatus(PlanStatus status) {
|
||||
this.status = status;
|
||||
public void setStatusId(UUID statusId) {
|
||||
this.statusId = statusId;
|
||||
}
|
||||
|
||||
public PlanAccessType getAccessType() {
|
||||
|
|
|
@ -35,9 +35,9 @@ public class NestedPlanElasticEntity {
|
|||
private PlanVersionStatus versionStatus;
|
||||
public final static String _versionStatus = "versionStatus";
|
||||
|
||||
@Field(value = NestedPlanElasticEntity._status, type = FieldType.Short)
|
||||
private PlanStatus status;
|
||||
public final static String _status = "status";
|
||||
@Field(value = NestedPlanElasticEntity._statusId, type = FieldType.Keyword)
|
||||
private UUID statusId;
|
||||
public final static String _statusId = "statusId";
|
||||
|
||||
@Field(value = NestedPlanElasticEntity._accessType, type = FieldType.Short)
|
||||
private PlanAccessType accessType;
|
||||
|
@ -103,12 +103,12 @@ public class NestedPlanElasticEntity {
|
|||
this.version = version;
|
||||
}
|
||||
|
||||
public PlanStatus getStatus() {
|
||||
return status;
|
||||
public UUID getStatusId() {
|
||||
return statusId;
|
||||
}
|
||||
|
||||
public void setStatus(PlanStatus status) {
|
||||
this.status = status;
|
||||
public void setStatusId(UUID statusId) {
|
||||
this.statusId = statusId;
|
||||
}
|
||||
|
||||
public PlanAccessType getAccessType() {
|
||||
|
|
|
@ -63,7 +63,7 @@ public class DescriptionElasticBuilder extends BaseElasticBuilder<DescriptionEla
|
|||
m.setId(d.getId());
|
||||
m.setLabel(d.getLabel());
|
||||
m.setDescription(d.getDescription());
|
||||
m.setStatus(d.getStatus());
|
||||
m.setStatusId(d.getStatusId());
|
||||
m.setCreatedAt(Date.from(d.getCreatedAt()));
|
||||
m.setUpdatedAt(Date.from(d.getUpdatedAt()));
|
||||
if (d.getFinalizedAt() != null) {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class PlanElasticBuilder extends BaseElasticBuilder<PlanElasticEntity, Pl
|
|||
m.setDescription(d.getDescription());
|
||||
m.setVersion(d.getVersion());
|
||||
m.setVersionStatus(d.getVersionStatus());
|
||||
m.setStatus(d.getStatus());
|
||||
m.setStatusId(d.getStatusId());
|
||||
m.setAccessType(d.getAccessType());
|
||||
m.setLanguage(d.getLanguage());
|
||||
m.setBlueprintId(d.getBlueprintId());
|
||||
|
|
|
@ -60,7 +60,7 @@ public class NestedPlanElasticBuilder extends BaseElasticBuilder<NestedPlanElast
|
|||
m.setLabel(d.getLabel());
|
||||
m.setDescription(d.getDescription());
|
||||
m.setVersion(d.getVersion());
|
||||
m.setStatus(d.getStatus());
|
||||
m.setStatusId(d.getStatusId());
|
||||
m.setAccessType(d.getAccessType());
|
||||
m.setLanguage(d.getLanguage());
|
||||
m.setBlueprintId(d.getBlueprintId());
|
||||
|
|
|
@ -50,7 +50,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
|
|||
private Instant finalizedBefore;
|
||||
private Collection<UUID> excludedIds;
|
||||
private Collection<UUID> tenantIds;
|
||||
private Collection<DescriptionStatus> statuses;
|
||||
private Collection<UUID> statusIds;
|
||||
private NestedDescriptionTemplateElasticQuery descriptionTemplateSubQuery;
|
||||
private NestedReferenceElasticQuery referenceSubQuery;
|
||||
private NestedTagElasticQuery tagSubQuery;
|
||||
|
@ -133,18 +133,18 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
|
|||
return this;
|
||||
}
|
||||
|
||||
public DescriptionElasticQuery statuses(DescriptionStatus value) {
|
||||
this.statuses = List.of(value);
|
||||
public DescriptionElasticQuery statusIds(UUID value) {
|
||||
this.statusIds = List.of(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DescriptionElasticQuery statuses(DescriptionStatus... value) {
|
||||
this.statuses = Arrays.asList(value);
|
||||
public DescriptionElasticQuery statusIds(UUID... value) {
|
||||
this.statusIds = Arrays.asList(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DescriptionElasticQuery statuses(Collection<DescriptionStatus> values) {
|
||||
this.statuses = values;
|
||||
public DescriptionElasticQuery statusIds(Collection<UUID> values) {
|
||||
this.statusIds = values;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
|
|||
protected Boolean isFalseQuery() {
|
||||
return this.isEmpty(this.ids) ||
|
||||
this.isEmpty(this.excludedIds) ||
|
||||
this.isEmpty(this.statuses);
|
||||
this.isEmpty(this.statusIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -230,7 +230,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
|
|||
List<Query> predicates = new ArrayList<>();
|
||||
if (usePublic ) {
|
||||
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())
|
||||
));
|
||||
}
|
||||
|
@ -284,8 +284,8 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
|
|||
if (this.tenantIds != null) {
|
||||
predicates.add(this.containsUUID(this.elasticFieldOf(DescriptionElasticEntity._tenantId), this.tenantIds)._toQuery());
|
||||
}
|
||||
if (this.statuses != null) {
|
||||
predicates.add(this.contains(this.elasticFieldOf(DescriptionElasticEntity._status), this.statuses.stream().map(DescriptionStatus::getValue).toList().toArray(new Short[this.statuses.size()]))._toQuery());
|
||||
if (this.statusIds != null) {
|
||||
predicates.add(this.containsUUID(this.elasticFieldOf(DescriptionElasticEntity._statusId), this.statusIds)._toQuery());
|
||||
}
|
||||
if (this.finalizedAfter != null) {
|
||||
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._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._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._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));
|
||||
|
@ -340,7 +340,7 @@ public class DescriptionElasticQuery extends ElasticQuery<DescriptionElasticEnti
|
|||
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._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._createdAt)) return this.elasticFieldOf(DescriptionElasticEntity._createdAt);
|
||||
else if (item.match(DescriptionElasticEntity._updatedAt)) return this.elasticFieldOf(DescriptionElasticEntity._updatedAt);
|
||||
|
|
|
@ -30,7 +30,7 @@ public class InnerObjectPlanElasticQuery extends ElasticInnerObjectQuery<InnerOb
|
|||
private String like;
|
||||
private Collection<UUID> ids;
|
||||
private Collection<UUID> excludedIds;
|
||||
private Collection<PlanStatus> statuses;
|
||||
private Collection<UUID> statusIds;
|
||||
private Collection<PlanVersionStatus> versionStatuses;
|
||||
private Collection<PlanAccessType> accessTypes;
|
||||
private Collection<Integer> versions;
|
||||
|
@ -108,18 +108,18 @@ public class InnerObjectPlanElasticQuery extends ElasticInnerObjectQuery<InnerOb
|
|||
return this;
|
||||
}
|
||||
|
||||
public InnerObjectPlanElasticQuery statuses(PlanStatus value) {
|
||||
this.statuses = List.of(value);
|
||||
public InnerObjectPlanElasticQuery statusIds(UUID value) {
|
||||
this.statusIds = List.of(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public InnerObjectPlanElasticQuery statuses(PlanStatus... value) {
|
||||
this.statuses = Arrays.asList(value);
|
||||
public InnerObjectPlanElasticQuery statusIds(UUID... value) {
|
||||
this.statusIds = Arrays.asList(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public InnerObjectPlanElasticQuery statuses(Collection<PlanStatus> values) {
|
||||
this.statuses = values;
|
||||
public InnerObjectPlanElasticQuery statusIds(Collection<UUID> values) {
|
||||
this.statusIds = values;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -203,8 +203,8 @@ public class InnerObjectPlanElasticQuery extends ElasticInnerObjectQuery<InnerOb
|
|||
if (this.excludedIds != null) {
|
||||
predicates.add(this.not(this.containsUUID(this.elasticFieldOf(NestedPlanElasticEntity._id).disableInfer(true), this.excludedIds)._toQuery())._toQuery());
|
||||
}
|
||||
if (this.statuses != 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());
|
||||
if (this.statusIds != null) {
|
||||
predicates.add(this.containsUUID(this.elasticFieldOf(NestedPlanElasticEntity._id).disableInfer(true), this.statusIds)._toQuery());
|
||||
}
|
||||
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());
|
||||
|
@ -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._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._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._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));
|
||||
|
@ -245,7 +245,7 @@ public class InnerObjectPlanElasticQuery extends ElasticInnerObjectQuery<InnerOb
|
|||
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._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._version)) return this.elasticFieldOf(NestedPlanElasticEntity._version);
|
||||
else if (item.match(NestedPlanElasticEntity._groupId)) return this.elasticFieldOf(NestedPlanElasticEntity._groupId);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
|
|||
private String like;
|
||||
private Collection<UUID> ids;
|
||||
private Collection<UUID> excludedIds;
|
||||
private Collection<PlanStatus> statuses;
|
||||
private Collection<UUID> statusIds;
|
||||
private Collection<PlanVersionStatus> versionStatuses;
|
||||
private Collection<PlanAccessType> accessTypes;
|
||||
private Collection<Integer> versions;
|
||||
|
@ -140,18 +140,18 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public PlanElasticQuery statuses(PlanStatus value) {
|
||||
this.statuses = List.of(value);
|
||||
public PlanElasticQuery statuses(UUID value) {
|
||||
this.statusIds = List.of(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlanElasticQuery statuses(PlanStatus... value) {
|
||||
this.statuses = Arrays.asList(value);
|
||||
public PlanElasticQuery statuses(UUID... value) {
|
||||
this.statusIds = Arrays.asList(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlanElasticQuery statuses(Collection<PlanStatus> values) {
|
||||
this.statuses = values;
|
||||
public PlanElasticQuery statuses(Collection<UUID> values) {
|
||||
this.statusIds = values;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
|
|||
|
||||
@Override
|
||||
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
|
||||
|
@ -265,7 +265,7 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
|
|||
List<Query> predicates = new ArrayList<>();
|
||||
if (usePublic) {
|
||||
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())
|
||||
));
|
||||
}
|
||||
|
@ -328,8 +328,8 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
|
|||
if (this.excludedIds != null) {
|
||||
predicates.add(this.not(this.containsUUID(this.elasticFieldOf(PlanElasticEntity._id), this.excludedIds)._toQuery())._toQuery());
|
||||
}
|
||||
if (this.statuses != null) {
|
||||
predicates.add(this.contains(this.elasticFieldOf(PlanElasticEntity._status), this.statuses.stream().map(PlanStatus::getValue).toList().toArray(new Short[this.statuses.size()]))._toQuery());
|
||||
if (this.statusIds != null) {
|
||||
predicates.add(this.containsUUID(this.elasticFieldOf(PlanElasticEntity._statusId), this.statusIds)._toQuery());
|
||||
}
|
||||
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());
|
||||
|
@ -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._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._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._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));
|
||||
|
@ -383,7 +383,7 @@ public class PlanElasticQuery extends ElasticQuery<PlanElasticEntity, UUID> {
|
|||
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._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._versionStatus)) return this.elasticFieldOf(PlanElasticEntity._versionStatus);
|
||||
else if (item.match(PlanElasticEntity._groupId)) return this.elasticFieldOf(PlanElasticEntity._groupId);
|
||||
|
|
|
@ -6,9 +6,7 @@ import org.opencdmp.commons.enums.IsActive;
|
|||
import org.opencdmp.commons.enums.RecentActivityOrder;
|
||||
import org.opencdmp.model.description.Description;
|
||||
import org.opencdmp.model.plan.Plan;
|
||||
import org.opencdmp.query.lookup.DescriptionLookup;
|
||||
import org.opencdmp.query.lookup.PlanLookup;
|
||||
import org.opencdmp.query.lookup.PlanUserLookup;
|
||||
import org.opencdmp.query.lookup.*;
|
||||
import gr.cite.tools.data.query.Ordering;
|
||||
import gr.cite.tools.data.query.Paging;
|
||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||
|
@ -97,8 +95,12 @@ public class RecentActivityItemLookup{
|
|||
DescriptionLookup lookup = new DescriptionLookup();
|
||||
lookup.setIsActive(List.of(IsActive.Active));
|
||||
if (this.like != null) lookup.setLike(this.like);
|
||||
if (this.onlyDraft != null) lookup.setStatuses(List.of(DescriptionStatus.Draft));
|
||||
else lookup.setStatuses(List.of(DescriptionStatus.Draft, DescriptionStatus.Finalized));
|
||||
if (this.onlyDraft != null) {
|
||||
DescriptionStatusLookup descriptionStatusLookup = new DescriptionStatusLookup();
|
||||
descriptionStatusLookup.setInternalStatuses(List.of(DescriptionStatus.Draft));
|
||||
descriptionStatusLookup.setIsActive(List.of(IsActive.Active));
|
||||
lookup.setDescriptionStatusSubQuery(descriptionStatusLookup);
|
||||
}
|
||||
if (this.userIds != null) {
|
||||
PlanLookup planLookup = new PlanLookup();
|
||||
PlanUserLookup planUserLookup = new PlanUserLookup();
|
||||
|
@ -131,7 +133,12 @@ public class RecentActivityItemLookup{
|
|||
PlanLookup lookup = new PlanLookup();
|
||||
lookup.setIsActive(List.of(IsActive.Active));
|
||||
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) {
|
||||
PlanUserLookup planUserLookup = new PlanUserLookup();
|
||||
planUserLookup.setUserIds(this.userIds);
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
|||
import org.opencdmp.query.DescriptionTemplateQuery;
|
||||
import org.opencdmp.query.PlanDescriptionTemplateQuery;
|
||||
import org.opencdmp.query.PlanQuery;
|
||||
import org.opencdmp.query.PlanStatusQuery;
|
||||
import org.opencdmp.service.visibility.VisibilityService;
|
||||
import org.opencdmp.service.visibility.VisibilityServiceImpl;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -197,7 +198,8 @@ public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder<Descri
|
|||
if (this.isPublic) {
|
||||
try {
|
||||
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);
|
||||
try {
|
||||
this.entityManager.reloadTenantFilters();
|
||||
|
|
|
@ -219,7 +219,8 @@ public class PlanCommonModelBuilder extends BaseCommonModelBuilder<PlanModel, Pl
|
|||
if (this.isPublic) {
|
||||
try {
|
||||
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);
|
||||
try {
|
||||
this.entityManager.reloadTenantFilters();
|
||||
|
|
|
@ -58,7 +58,7 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
|||
|
||||
private Collection<IsActive> isActives;
|
||||
|
||||
private Collection<DescriptionStatus> statuses;
|
||||
private Collection<UUID> statusIds;
|
||||
|
||||
private Collection<UUID> planIds;
|
||||
|
||||
|
@ -72,6 +72,8 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
|||
|
||||
private Collection<UUID> planDescriptionTemplateIds;
|
||||
|
||||
private DescriptionStatusQuery descriptionStatusQuery;
|
||||
|
||||
private final TenantEntityManager tenantEntityManager;
|
||||
public DescriptionQuery(UserScope userScope, AuthorizationService authService, QueryUtilsService queryUtilsService, TenantEntityManager tenantEntityManager) {
|
||||
this.userScope = userScope;
|
||||
|
@ -210,18 +212,18 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public DescriptionQuery statuses(DescriptionStatus value) {
|
||||
this.statuses = List.of(value);
|
||||
public DescriptionQuery statusIds(UUID value) {
|
||||
this.statusIds = List.of(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DescriptionQuery statuses(DescriptionStatus... value) {
|
||||
this.statuses = Arrays.asList(value);
|
||||
public DescriptionQuery statusIds(UUID... value) {
|
||||
this.statusIds = Arrays.asList(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DescriptionQuery statuses(Collection<DescriptionStatus> values) {
|
||||
this.statuses = values;
|
||||
public DescriptionQuery statusIds(Collection<UUID> values) {
|
||||
this.statusIds = values;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -250,6 +252,11 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public DescriptionQuery descriptionStatusSubQuery(DescriptionStatusQuery subQuery) {
|
||||
this.descriptionStatusQuery = subQuery;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EntityManager entityManager(){
|
||||
return this.tenantEntityManager.getEntityManager();
|
||||
|
@ -261,7 +268,7 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
|||
this.isEmpty(this.ids) ||
|
||||
this.isEmpty(this.isActives) || this.isEmpty(this.createdByIds) ||
|
||||
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
|
||||
|
@ -349,9 +356,9 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
|||
inClause.value(item);
|
||||
predicates.add(inClause);
|
||||
}
|
||||
if (this.statuses != null) {
|
||||
CriteriaBuilder.In<DescriptionStatus> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._status));
|
||||
for (DescriptionStatus item : this.statuses)
|
||||
if (this.statusIds != null) {
|
||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._statusId));
|
||||
for (UUID item : this.statusIds)
|
||||
inClause.value(item);
|
||||
predicates.add(inClause);
|
||||
}
|
||||
|
@ -381,6 +388,10 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
|||
inClause.value(item);
|
||||
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()) {
|
||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||
|
|
|
@ -39,7 +39,7 @@ public class PlanQuery extends QueryBase<PlanEntity> {
|
|||
|
||||
private Collection<IsActive> isActives;
|
||||
|
||||
private Collection<PlanStatus> statuses;
|
||||
private Collection<UUID> statusIds;
|
||||
|
||||
private Collection<PlanVersionStatus> versionStatuses;
|
||||
|
||||
|
@ -61,6 +61,8 @@ public class PlanQuery extends QueryBase<PlanEntity> {
|
|||
|
||||
private EntityDoiQuery entityDoiQuery;
|
||||
|
||||
private PlanStatusQuery planStatusQuery;
|
||||
|
||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||
|
||||
private final UserScope userScope;
|
||||
|
@ -177,18 +179,18 @@ public class PlanQuery extends QueryBase<PlanEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public PlanQuery statuses(PlanStatus value) {
|
||||
this.statuses = List.of(value);
|
||||
public PlanQuery statusIds(UUID value) {
|
||||
this.statusIds = List.of(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlanQuery statuses(PlanStatus... value) {
|
||||
this.statuses = Arrays.asList(value);
|
||||
public PlanQuery statusIds(UUID... value) {
|
||||
this.statusIds = Arrays.asList(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlanQuery statuses(Collection<PlanStatus> values) {
|
||||
this.statuses = values;
|
||||
public PlanQuery statusIds(Collection<UUID> values) {
|
||||
this.statusIds = values;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -253,6 +255,11 @@ public class PlanQuery extends QueryBase<PlanEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public PlanQuery planStatusSubQuery(PlanStatusQuery subQuery) {
|
||||
this.planStatusQuery = subQuery;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlanQuery authorize(EnumSet<AuthorizationFlags> values) {
|
||||
this.authorize = values;
|
||||
return this;
|
||||
|
@ -275,7 +282,7 @@ public class PlanQuery extends QueryBase<PlanEntity> {
|
|||
|
||||
@Override
|
||||
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
|
||||
|
@ -347,9 +354,9 @@ public class PlanQuery extends QueryBase<PlanEntity> {
|
|||
inClause.value(item);
|
||||
predicates.add(inClause);
|
||||
}
|
||||
if (this.statuses != null) {
|
||||
CriteriaBuilder.In<PlanStatus> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._status));
|
||||
for (PlanStatus item : this.statuses)
|
||||
if (this.statusIds != null) {
|
||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._statusId));
|
||||
for (UUID item : this.statusIds)
|
||||
inClause.value(item);
|
||||
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));
|
||||
}
|
||||
|
||||
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()) {
|
||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.opencdmp.query.lookup;
|
|||
import gr.cite.tools.data.query.Lookup;
|
||||
import gr.cite.tools.data.query.QueryFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.opencdmp.commons.enums.DescriptionStatus;
|
||||
import org.opencdmp.commons.enums.IsActive;
|
||||
import org.opencdmp.elastic.query.DescriptionElasticQuery;
|
||||
import org.opencdmp.query.DescriptionQuery;
|
||||
|
@ -31,7 +30,8 @@ public class DescriptionLookup extends Lookup {
|
|||
|
||||
private List<IsActive> isActive;
|
||||
|
||||
private List<DescriptionStatus> statuses;
|
||||
private List<UUID> statusIds;
|
||||
private DescriptionStatusLookup descriptionStatusSubQuery;
|
||||
|
||||
public String getLike() {
|
||||
return this.like;
|
||||
|
@ -65,12 +65,12 @@ public class DescriptionLookup extends Lookup {
|
|||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
public List<DescriptionStatus> getStatuses() {
|
||||
return this.statuses;
|
||||
public List<UUID> getStatusIds() {
|
||||
return statusIds;
|
||||
}
|
||||
|
||||
public void setStatuses(List<DescriptionStatus> statuses) {
|
||||
this.statuses = statuses;
|
||||
public void setStatusIds(List<UUID> statusIds) {
|
||||
this.statusIds = statusIds;
|
||||
}
|
||||
|
||||
public PlanLookup getPlanSubQuery() {
|
||||
|
@ -127,6 +127,14 @@ public class DescriptionLookup extends Lookup {
|
|||
this.finalizedBefore = finalizedBefore;
|
||||
}
|
||||
|
||||
public DescriptionStatusLookup getDescriptionStatusSubQuery() {
|
||||
return descriptionStatusSubQuery;
|
||||
}
|
||||
|
||||
public void setDescriptionStatusSubQuery(DescriptionStatusLookup descriptionStatusSubQuery) {
|
||||
this.descriptionStatusSubQuery = descriptionStatusSubQuery;
|
||||
}
|
||||
|
||||
public DescriptionQuery enrich(QueryFactory queryFactory) {
|
||||
DescriptionQuery query = queryFactory.query(DescriptionQuery.class);
|
||||
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.descriptionTagSubQuery != null) query.descriptionTagSubQuery(this.descriptionTagSubQuery.enrich(queryFactory));
|
||||
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.createdBefore != null) query.createdBefore(this.createdBefore);
|
||||
if (this.finalizedAfter != null) query.finalizedAfter(this.finalizedAfter);
|
||||
if (this.finalizedBefore != null) query.finalizedBefore(this.finalizedBefore);
|
||||
if (this.descriptionStatusSubQuery != null) query.descriptionStatusSubQuery(this.descriptionStatusSubQuery.enrich(queryFactory));
|
||||
|
||||
this.enrichCommon(query);
|
||||
|
||||
|
@ -154,7 +163,7 @@ public class DescriptionLookup extends Lookup {
|
|||
if (this.like != null) query.like(StringUtils.strip(this.like, "%"));
|
||||
if (this.ids != null) query.ids(this.ids);
|
||||
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.createdBefore != null) query.createdBefore(this.createdBefore);
|
||||
if (this.finalizedAfter != null) query.finalizedAfter(this.finalizedAfter);
|
||||
|
|
|
@ -4,7 +4,6 @@ import gr.cite.tools.data.query.Lookup;
|
|||
import gr.cite.tools.data.query.QueryFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.opencdmp.commons.enums.PlanAccessType;
|
||||
import org.opencdmp.commons.enums.PlanStatus;
|
||||
import org.opencdmp.commons.enums.PlanVersionStatus;
|
||||
import org.opencdmp.commons.enums.IsActive;
|
||||
import org.opencdmp.elastic.query.PlanElasticQuery;
|
||||
|
@ -27,7 +26,7 @@ public class PlanLookup extends Lookup {
|
|||
private List<IsActive> isActive;
|
||||
private List<PlanVersionStatus> versionStatuses;
|
||||
|
||||
private List<PlanStatus> statuses;
|
||||
private List<UUID> statusIds;
|
||||
private List<PlanAccessType> accessTypes;
|
||||
|
||||
private List<Integer> versions;
|
||||
|
@ -36,6 +35,7 @@ public class PlanLookup extends Lookup {
|
|||
private PlanUserLookup planUserSubQuery;
|
||||
private PlanBlueprintLookup planBlueprintSubQuery;
|
||||
private PlanReferenceLookup planReferenceSubQuery;
|
||||
private PlanStatusLookup planStatusSubQuery;
|
||||
|
||||
public String getLike() {
|
||||
return this.like;
|
||||
|
@ -73,12 +73,12 @@ public class PlanLookup extends Lookup {
|
|||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
public List<PlanStatus> getStatuses() {
|
||||
return this.statuses;
|
||||
public List<UUID> getStatusIds() {
|
||||
return statusIds;
|
||||
}
|
||||
|
||||
public void setStatuses(List<PlanStatus> statuses) {
|
||||
this.statuses = statuses;
|
||||
public void setStatusIds(List<UUID> statusIds) {
|
||||
this.statusIds = statusIds;
|
||||
}
|
||||
|
||||
public List<Integer> getVersions() {
|
||||
|
@ -138,6 +138,14 @@ public class PlanLookup extends Lookup {
|
|||
|
||||
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) {
|
||||
PlanQuery query = queryFactory.query(PlanQuery.class);
|
||||
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.accessTypes != null) query.accessTypes(this.accessTypes);
|
||||
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.versionStatuses != null) query.versionStatuses(this.versionStatuses);
|
||||
if (this.planDescriptionTemplateSubQuery != null) query.planDescriptionTemplateSubQuery(this.planDescriptionTemplateSubQuery.enrich(queryFactory));
|
||||
if (this.planUserSubQuery != null) query.planUserSubQuery(this.planUserSubQuery.enrich(queryFactory));
|
||||
if (this.planBlueprintSubQuery != null) query.planBlueprintSubQuery(this.planBlueprintSubQuery.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);
|
||||
|
||||
|
@ -167,7 +176,7 @@ public class PlanLookup extends Lookup {
|
|||
if (this.groupIds != null) query.groupIds(this.groupIds);
|
||||
if (this.excludedIds != null) query.excludedIds(this.excludedIds);
|
||||
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.versionStatuses != null) query.versionStatuses(this.versionStatuses);
|
||||
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.planReferenceSubQuery != null) query.referenceSubQuery(this.planReferenceSubQuery.enrichElasticInner(queryFactory));
|
||||
if (this.tenantSubQuery != null) throw new UnsupportedOperationException();
|
||||
if (this.planStatusSubQuery != null) throw new UnsupportedOperationException();
|
||||
|
||||
this.enrichCommon(query);
|
||||
|
||||
|
@ -188,7 +198,7 @@ public class PlanLookup extends Lookup {
|
|||
if (this.groupIds != null) query.groupIds(this.groupIds);
|
||||
if (this.excludedIds != null) query.excludedIds(this.excludedIds);
|
||||
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.versionStatuses != null) query.versionStatuses(this.versionStatuses);
|
||||
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.planReferenceSubQuery != null) throw new UnsupportedOperationException("");
|
||||
if (this.tenantSubQuery != null) throw new UnsupportedOperationException();
|
||||
if (this.planStatusSubQuery != null) throw new UnsupportedOperationException();
|
||||
|
||||
return query;
|
||||
}
|
||||
|
|
|
@ -77,9 +77,9 @@ public class DashboardServiceImpl implements DashboardService {
|
|||
descriptionLookup.getPage().setOffset(0);
|
||||
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())) {
|
||||
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().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())) {
|
||||
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()){
|
||||
case Label -> comparator = Comparator.comparing(RecentActivityItemEntity::getLabel).thenComparing(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()) ;
|
||||
}
|
||||
}
|
||||
|
@ -118,10 +118,12 @@ public class DashboardServiceImpl implements DashboardService {
|
|||
|
||||
DashboardStatisticsCacheService.DashboardStatisticsCacheValue cacheValue = this.dashboardStatisticsCacheService.lookup(this.dashboardStatisticsCacheService.buildKey(DashboardStatisticsCacheService.publicKey));
|
||||
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();
|
||||
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<>());
|
||||
if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){
|
||||
|
|
|
@ -1200,7 +1200,8 @@ public class DescriptionServiceImpl implements DescriptionService {
|
|||
} else {
|
||||
try {
|
||||
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();
|
||||
} finally {
|
||||
this.entityManager.reloadTenantFilters();
|
||||
|
@ -1233,7 +1234,8 @@ public class DescriptionServiceImpl implements DescriptionService {
|
|||
DescriptionEntity data = null;
|
||||
try {
|
||||
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();
|
||||
} finally {
|
||||
this.entityManager.reloadTenantFilters();
|
||||
|
|
|
@ -136,7 +136,7 @@ public class ElasticServiceImpl implements ElasticService {
|
|||
propertyMap.put(DescriptionElasticEntity._tenantId, this.createElastic(FieldType.Keyword, false));
|
||||
propertyMap.put(DescriptionElasticEntity._label, 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._createdAt, 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._label, this.createElastic(FieldType.Text, true));
|
||||
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._language, 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._label, this.createElastic(FieldType.Text, true));
|
||||
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._versionStatus, this.createElastic(FieldType.Short, false));
|
||||
propertyMap.put(NestedPlanElasticEntity._language, this.createElastic(FieldType.Keyword, false));
|
||||
|
|
|
@ -268,7 +268,8 @@ public class FileTransformerServiceImpl implements FileTransformerService {
|
|||
} else {
|
||||
try {
|
||||
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();
|
||||
} finally {
|
||||
this.entityManager.reloadTenantFilters();
|
||||
|
@ -307,7 +308,8 @@ public class FileTransformerServiceImpl implements FileTransformerService {
|
|||
} else {
|
||||
try {
|
||||
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();
|
||||
} finally {
|
||||
this.entityManager.reloadTenantFilters();
|
||||
|
|
|
@ -325,21 +325,24 @@ public class MetricsServiceImpl implements MetricsService {
|
|||
}
|
||||
|
||||
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)
|
||||
planQuery.after(this._config.getNexusDate());
|
||||
return planQuery.count();
|
||||
}
|
||||
|
||||
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)
|
||||
planQuery.after(this._config.getNexusDate());
|
||||
return planQuery.count();
|
||||
}
|
||||
|
||||
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)
|
||||
planQuery.after(this._config.getNexusDate());
|
||||
return planQuery.count();
|
||||
|
@ -355,8 +358,10 @@ public class MetricsServiceImpl implements MetricsService {
|
|||
return planQuery.count();
|
||||
}
|
||||
|
||||
private double calculateDraftDmpsWithGrant(boolean forNexus) {
|
||||
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).statuses(PlanStatus.Draft).disableTracking().isActive(IsActive.Active);
|
||||
private double calculateDraftDmpsWithGrant(boolean forNexus)
|
||||
{
|
||||
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)
|
||||
planQuery.after(this._config.getNexusDate());
|
||||
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) {
|
||||
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)
|
||||
planQuery.after(this._config.getNexusDate());
|
||||
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) {
|
||||
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)
|
||||
planQuery.after(this._config.getNexusDate());
|
||||
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) {
|
||||
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)
|
||||
descriptionQuery.createdAfter(this._config.getNexusDate());
|
||||
return descriptionQuery.count();
|
||||
}
|
||||
|
||||
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)
|
||||
descriptionQuery.createdAfter(this._config.getNexusDate());
|
||||
return descriptionQuery.count();
|
||||
}
|
||||
|
||||
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)
|
||||
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);
|
||||
return descriptionQuery.count();
|
||||
}
|
||||
|
||||
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)
|
||||
descriptionQuery.createdAfter(this._config.getNexusDate());
|
||||
PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active);
|
||||
|
|
|
@ -710,7 +710,8 @@ public class PlanServiceImpl implements PlanService {
|
|||
List<TagEntity> tags = new ArrayList<>();
|
||||
try {
|
||||
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()));
|
||||
|
||||
|
@ -1040,7 +1041,8 @@ public class PlanServiceImpl implements PlanService {
|
|||
try {
|
||||
this.entityManager.disableTenantFilters();
|
||||
// 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()));
|
||||
|
||||
|
@ -2081,7 +2083,8 @@ public class PlanServiceImpl implements PlanService {
|
|||
} else {
|
||||
try {
|
||||
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();
|
||||
} finally {
|
||||
this.entityManager.reloadTenantFilters();
|
||||
|
@ -2115,7 +2118,8 @@ public class PlanServiceImpl implements PlanService {
|
|||
PlanEntity data = null;
|
||||
try {
|
||||
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();
|
||||
} finally {
|
||||
this.entityManager.reloadTenantFilters();
|
||||
|
|
|
@ -45,6 +45,7 @@ import org.opencdmp.model.persist.*;
|
|||
import org.opencdmp.model.result.QueryResult;
|
||||
import org.opencdmp.query.DescriptionQuery;
|
||||
import org.opencdmp.query.PlanQuery;
|
||||
import org.opencdmp.query.PlanStatusQuery;
|
||||
import org.opencdmp.query.lookup.DescriptionLookup;
|
||||
import org.opencdmp.service.description.DescriptionService;
|
||||
import org.opencdmp.service.elastic.ElasticQueryHelperService;
|
||||
|
@ -147,7 +148,8 @@ public class DescriptionController {
|
|||
|
||||
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));
|
||||
if (model == null)
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.opencdmp.model.persist.*;
|
|||
import org.opencdmp.model.plan.Plan;
|
||||
import org.opencdmp.model.result.QueryResult;
|
||||
import org.opencdmp.query.PlanQuery;
|
||||
import org.opencdmp.query.PlanStatusQuery;
|
||||
import org.opencdmp.query.lookup.PlanLookup;
|
||||
import org.opencdmp.service.elastic.ElasticQueryHelperService;
|
||||
import org.opencdmp.service.plan.PlanService;
|
||||
|
@ -131,7 +132,8 @@ public class PlanController {
|
|||
|
||||
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));
|
||||
if (model == null)
|
||||
|
|
|
@ -120,8 +120,11 @@ permissions:
|
|||
BrowseDescriptionStatus:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
- InstallationAdmin
|
||||
- TenantPlanManager
|
||||
- TenantConfigManager
|
||||
- TenantAdmin
|
||||
- TenantUser
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
|
@ -174,8 +177,11 @@ permissions:
|
|||
BrowsePlanStatus:
|
||||
roles:
|
||||
- Admin
|
||||
- TenantAdmin
|
||||
- InstallationAdmin
|
||||
- TenantPlanManager
|
||||
- TenantConfigManager
|
||||
- TenantAdmin
|
||||
- TenantUser
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { Lookup } from '@common/model/lookup';
|
||||
import { Guid } from '@common/types/guid';
|
||||
import { IsActive } from '../common/enum/is-active.enum';
|
||||
import { DescriptionStatusEnum } from '../common/enum/description-status';
|
||||
import { PlanLookup } from './plan.lookup';
|
||||
import { DescriptionReferenceLookup } from './reference.lookup';
|
||||
import { DescriptionTagLookup } from './tag.lookup';
|
||||
|
@ -17,7 +16,7 @@ export class DescriptionLookup extends Lookup implements DescriptionFilter {
|
|||
finalizedAfter: Date;
|
||||
finalizedBefore: Date;
|
||||
isActive: IsActive[];
|
||||
statuses: DescriptionStatusEnum[];
|
||||
statusIds: Guid[];
|
||||
|
||||
planSubQuery: PlanLookup;
|
||||
tenantSubQuery: TenantLookup;
|
||||
|
@ -39,7 +38,7 @@ export interface DescriptionFilter {
|
|||
finalizedAfter: Date;
|
||||
finalizedBefore: Date;
|
||||
isActive: IsActive[];
|
||||
statuses: DescriptionStatusEnum[];
|
||||
statusIds: Guid[];
|
||||
|
||||
planSubQuery: PlanLookup;
|
||||
descriptionTemplateSubQuery: DescriptionTemplateLookup;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { Lookup } from '@common/model/lookup';
|
||||
import { Guid } from '@common/types/guid';
|
||||
import { PlanAccessType } from '../common/enum/plan-access-type';
|
||||
import { PlanStatusEnum } from '../common/enum/plan-status';
|
||||
import { PlanVersionStatus } from '../common/enum/plan-version-status';
|
||||
import { IsActive } from '../common/enum/is-active.enum';
|
||||
import { PlanDescriptionTemplateLookup } from './plan-description-template.lookup';
|
||||
|
@ -9,6 +8,7 @@ import { PlanUserLookup } from './plan-user.lookup';
|
|||
import { PlanBlueprintLookup } from './plan-blueprint.lookup';
|
||||
import { PlanReferenceLookup } from './reference.lookup';
|
||||
import { TenantLookup } from './tenant.lookup';
|
||||
import { PlanStatusLookup } from './plan-status.lookup';
|
||||
|
||||
export class PlanLookup extends Lookup implements PlanFilter {
|
||||
ids: Guid[];
|
||||
|
@ -16,7 +16,7 @@ export class PlanLookup extends Lookup implements PlanFilter {
|
|||
like: string;
|
||||
isActive: IsActive[];
|
||||
versionStatuses: PlanVersionStatus[];
|
||||
statuses: PlanStatusEnum[];
|
||||
statusIds: Guid[];
|
||||
accessTypes: PlanAccessType[];
|
||||
versions: Number[];
|
||||
groupIds: Guid[];
|
||||
|
@ -26,6 +26,7 @@ export class PlanLookup extends Lookup implements PlanFilter {
|
|||
planBlueprintSubQuery: PlanBlueprintLookup;
|
||||
planDescriptionTemplateSubQuery: PlanDescriptionTemplateLookup;
|
||||
planReferenceSubQuery: PlanReferenceLookup;
|
||||
planStatusSubQuery: PlanStatusLookup;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -38,7 +39,7 @@ export interface PlanFilter {
|
|||
like: string;
|
||||
isActive: IsActive[];
|
||||
versionStatuses: PlanVersionStatus[];
|
||||
statuses: PlanStatusEnum[];
|
||||
statusIds: Guid[];
|
||||
accessTypes: PlanAccessType[];
|
||||
versions: Number[];
|
||||
groupIds: Guid[];
|
||||
|
@ -47,4 +48,5 @@ export interface PlanFilter {
|
|||
planBlueprintSubQuery: PlanBlueprintLookup;
|
||||
planDescriptionTemplateSubQuery: PlanDescriptionTemplateLookup;
|
||||
planReferenceSubQuery: PlanReferenceLookup;
|
||||
planStatusSubQuery: PlanStatusLookup;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Injectable } from "@angular/core";
|
|||
import { BaseHttpV2Service } from "../http/base-http-v2.service";
|
||||
import { ConfigurationService } from "../configuration/configuration.service";
|
||||
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 { DescriptionStatusLookup } from "@app/core/query/description-status.lookup";
|
||||
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 { FilterService } from "@common/modules/text-filter/filter-service";
|
||||
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()
|
||||
export class DescriptionStatusService {
|
||||
|
@ -65,6 +67,43 @@ export class DescriptionStatusService {
|
|||
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: {
|
||||
like?: string,
|
||||
excludedIds?: Guid[],
|
||||
|
|
|
@ -5,14 +5,15 @@ import { ConfigurationService } from "../configuration/configuration.service";
|
|||
import { PlanStatusLookup } from "@app/core/query/plan-status.lookup";
|
||||
import { PlanStatus } from "@app/core/model/plan-status/plan-status";
|
||||
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 { Guid } from "@common/types/guid";
|
||||
import { PlanLookup } from "@app/core/query/plan.lookup";
|
||||
import { FilterService } from "@common/modules/text-filter/filter-service";
|
||||
import { IsActive } from "@notification-service/core/enum/is-active.enum";
|
||||
import { nameof } from "ts-simple-nameof";
|
||||
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()
|
||||
export class PlanStatusService {
|
||||
|
@ -66,6 +67,43 @@ export class PlanStatusService {
|
|||
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: {
|
||||
like?: string,
|
||||
excludedIds?: Guid[],
|
||||
|
|
|
@ -251,13 +251,13 @@ export class PlanService {
|
|||
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();
|
||||
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.statuses = statuses;
|
||||
lookup.statusIds = statusIds;
|
||||
lookup.project = {
|
||||
fields: [
|
||||
nameof<Plan>(x => x.id),
|
||||
|
|
|
@ -19,6 +19,7 @@ import { DescriptionTemplatesInSection, PlanBlueprint, PlanBlueprintDefinition,
|
|||
import { TenantLookup } from '@app/core/query/tenant.lookup';
|
||||
import { Tenant } from '@app/core/model/tenant/tenant';
|
||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||
import { PlanStatusLookup } from '@app/core/query/plan-status.lookup';
|
||||
|
||||
@Component({
|
||||
selector: 'description-copy-dialog-component',
|
||||
|
@ -49,7 +50,9 @@ export class DescriptionCopyDialogComponent {
|
|||
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
|
||||
if (ids && ids.length > 0) { lookup.ids = ids; }
|
||||
lookup.isActive = [IsActive.Active];
|
||||
lookup.statuses = [PlanStatusEnum.Draft];
|
||||
const planStatusLookup: PlanStatusLookup = new PlanStatusLookup();
|
||||
planStatusLookup.internalStatuses = [PlanStatusEnum.Draft];
|
||||
lookup.planStatusSubQuery = planStatusLookup;
|
||||
lookup.project = {
|
||||
fields: [
|
||||
nameof<Plan>(x => x.id),
|
||||
|
|
|
@ -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)="saveAndContinue()" type="button">{{ 'DESCRIPTION-EDITOR.ACTIONS.SAVE-AND-CONTINUE' | translate }}</button>
|
||||
</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>
|
||||
</ng-container>
|
||||
<button [disabled]="saving" *ngIf="isLocked" mat-button disabled class="rounded-btn neutral cursor-default" type="button">{{ 'PLAN-OVERVIEW.LOCKED' | translate}}</button>
|
||||
|
|
|
@ -581,6 +581,10 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
}
|
||||
}
|
||||
|
||||
isNotFinalizedPlan(): boolean {
|
||||
return this.item.plan?.status?.internalStatus != PlanStatusEnum.Finalized;
|
||||
}
|
||||
|
||||
descriptionInfoValid(): boolean {
|
||||
return this.formGroup.get('label') && this.formGroup.get('label').valid && this.formGroup.get('descriptionTemplateId') && this.formGroup.get('descriptionTemplateId').valid;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
|||
return this.listingItems != null && this.listingItems.length > 0;
|
||||
}
|
||||
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.descriptionTagSubQuery != null || this.lookup.descriptionReferenceSubQuery != null ||
|
||||
this.lookup.tenantSubQuery != null;
|
||||
|
@ -415,7 +415,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
|||
}
|
||||
|
||||
_patchLookupFromFilters(filters: DescriptionListingFilters): DescriptionLookup {
|
||||
this.lookup.statuses = filters?.status != null ? [filters?.status] : null;
|
||||
this.lookup.statusIds = filters?.statusId != null ? [filters?.statusId] : null;
|
||||
|
||||
// Tenants
|
||||
let viewOnlyTenant = filters?.viewOnlyTenant ?? false;
|
||||
|
@ -474,7 +474,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
|||
private _countFilters(lookup: DescriptionLookup): number {
|
||||
let count = 0;
|
||||
|
||||
if (lookup.statuses) count += lookup.statuses.length;
|
||||
if (lookup.statusIds) count += lookup.statusIds.length;
|
||||
if (lookup.tenantSubQuery) count += 1;
|
||||
if (lookup.descriptionTemplateSubQuery) count += lookup.descriptionTemplateSubQuery.ids?.length;
|
||||
if (lookup.descriptionTagSubQuery) count += lookup.descriptionTagSubQuery.tagIds?.length;
|
||||
|
|
|
@ -47,7 +47,7 @@ export class DescriptionFilterDialogComponent implements OnInit {
|
|||
|
||||
private _buildDescriptionFilters(lookup: DescriptionLookup, references: ReferencesWithType[]): DescriptionListingFilters {
|
||||
return {
|
||||
status: lookup.statuses?.[0] ?? null,
|
||||
statusId: lookup.statusIds?.[0] ?? null,
|
||||
viewOnlyTenant: lookup.tenantSubQuery?.codes?.length > 0,
|
||||
role: lookup.planSubQuery?.planUserSubQuery?.userRoles?.[0] ?? null,
|
||||
descriptionTemplates: lookup.descriptionTemplateSubQuery?.ids ?? [],
|
||||
|
|
|
@ -11,12 +11,10 @@
|
|||
<!-- Status Filter-->
|
||||
<div class="col-10" *ngIf="!isPublic">
|
||||
<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-radio-button [value]="null" [checked]="formGroup.get('status')?.value == null" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.STATUS.TYPES.ANY' | translate }}</mat-radio-button>
|
||||
<mat-radio-button [value]="statuses.Draft" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.STATUS.TYPES.DRAFT' | translate }}</mat-radio-button>
|
||||
<mat-radio-button [value]="statuses.Finalized" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.STATUS.TYPES.FINALIZED' | translate }}</mat-radio-button>
|
||||
<mat-radio-button [value]="statuses.Canceled" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.STATUS.TYPES.CANCELED' | translate }}</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'DESCRIPTION-LISTING.FILTERS.STATUS.PLACEHOLDER' | translate }}</mat-label>
|
||||
<app-single-auto-complete [formControl]="formGroup.get('statusId')" [configuration]="descriptionStatusAutocompleteConfiguration"></app-single-auto-complete>
|
||||
</mat-form-field>
|
||||
<hr>
|
||||
</div>
|
||||
<!-- End of Status Filter-->
|
||||
|
|
|
@ -8,6 +8,7 @@ import { Reference } from '@app/core/model/reference/reference';
|
|||
import { ReferencesWithType } from '@app/core/query/description.lookup';
|
||||
import { ReferenceLookup } from '@app/core/query/reference.lookup';
|
||||
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 { PlanService } from '@app/core/services/plan/plan.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;
|
||||
tagAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = this.tagService.multipleAutocompleteConfiguration;
|
||||
referenceTypeAutocompleteConfiguration: SingleAutoCompleteConfiguration = this.getReferenceTypeAutocompleteConfiguration();
|
||||
descriptionStatusAutocompleteConfiguration: SingleAutoCompleteConfiguration = this.descriptionStatusService.singleAutocompleteConfiguration;
|
||||
referenceAutocompleteConfiguration: Map<Guid, MultipleAutoCompleteConfiguration>;
|
||||
|
||||
constructor(
|
||||
|
@ -67,6 +69,7 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent<Descriptio
|
|||
private tagService: TagService,
|
||||
private referenceService: ReferenceService,
|
||||
private referenceTypeService: ReferenceTypeService,
|
||||
private descriptionStatusService: DescriptionStatusService
|
||||
) {
|
||||
super(new ValidationErrorModel());
|
||||
}
|
||||
|
@ -77,7 +80,7 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent<Descriptio
|
|||
|
||||
buildForm(filters: DescriptionListingFilters) {
|
||||
this.formGroup = new FormGroup<DescriptionListingFilterForm>({
|
||||
status: new FormControl(filters?.status),
|
||||
statusId: new FormControl(filters?.statusId),
|
||||
viewOnlyTenant: new FormControl(filters.viewOnlyTenant),
|
||||
role: new FormControl(filters.role),
|
||||
descriptionTemplates: new FormControl(filters.descriptionTemplates),
|
||||
|
@ -110,7 +113,7 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent<Descriptio
|
|||
resetFilters() {
|
||||
this.formGroup.reset();
|
||||
this.formGroup.patchValue({
|
||||
status: null,
|
||||
statusId: null,
|
||||
viewOnlyTenant: null,
|
||||
role: null,
|
||||
descriptionTemplates: null,
|
||||
|
@ -209,7 +212,7 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent<Descriptio
|
|||
}
|
||||
|
||||
export interface DescriptionListingFilters {
|
||||
status: DescriptionStatusEnum,
|
||||
statusId: Guid,
|
||||
viewOnlyTenant: boolean,
|
||||
role: Guid,
|
||||
descriptionTemplates: Guid[],
|
||||
|
@ -219,7 +222,7 @@ export interface DescriptionListingFilters {
|
|||
}
|
||||
|
||||
interface DescriptionListingFilterForm {
|
||||
status: FormControl<DescriptionStatusEnum>,
|
||||
statusId: FormControl<Guid>,
|
||||
viewOnlyTenant: FormControl<boolean>,
|
||||
role: FormControl<Guid>,
|
||||
descriptionTemplates: FormControl<Guid[]>,
|
||||
|
|
|
@ -13,18 +13,18 @@
|
|||
</div>
|
||||
</div>
|
||||
</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.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 === 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.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 class="description-subtitle">
|
||||
<span *ngIf="isUserPlanRelated()" class="col-auto">{{ enumUtils.toPlanUserRolesString(planService.getCurrentUserRolesInPlan(description?.plan?.planUsers)) }}</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 *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 #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>
|
||||
<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>
|
||||
<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 #otherStatus><span *ngIf="!isPublic" class=" col-auto draft">{{ description.status?.name }}</span></ng-template>
|
||||
<span>.</span>
|
||||
<span class="col">{{'DESCRIPTION-LISTING.GRANT' | translate}}: {{referenceService.getReferencesForTypesFirstSafe(description?.plan?.planReferences, [this.referenceTypeService.getGrantReferenceType()])?.reference?.label}}</span>
|
||||
</div>
|
||||
|
|
|
@ -134,7 +134,7 @@
|
|||
<div class="row">
|
||||
<div class="col-12">
|
||||
<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 class="row align-items-center" (click)="persistStatus(status, description)">
|
||||
<div class="col-auto pr-0">
|
||||
|
|
|
@ -319,6 +319,10 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
|
|||
return description?.status?.internalStatus != DescriptionStatusEnum.Finalized;
|
||||
}
|
||||
|
||||
isNotFinalizedPlan(description: Description) {
|
||||
return description?.plan?.status?.internalStatus != PlanStatusEnum.Finalized;
|
||||
}
|
||||
|
||||
editClicked(description: Description) {
|
||||
this.router.navigate([this.routerUtils.generateUrl(['/descriptions/edit/', description.id.toString()])]);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import { nameof } from 'ts-simple-nameof';
|
|||
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||
import { TenantLookup } from '@app/core/query/tenant.lookup';
|
||||
import { Tenant } from '@app/core/model/tenant/tenant';
|
||||
import { PlanStatusLookup } from '@app/core/query/plan-status.lookup';
|
||||
|
||||
@Component({
|
||||
selector: 'app-start-new-description-dialog',
|
||||
|
@ -41,13 +42,15 @@ export class StartNewDescriptionDialogComponent extends BaseComponent {
|
|||
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();
|
||||
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.Active];
|
||||
lookup.statuses = [PlanStatusEnum.Draft];
|
||||
const planStatusLookup: PlanStatusLookup = new PlanStatusLookup();
|
||||
planStatusLookup.internalStatuses = [PlanStatusEnum.Draft];
|
||||
lookup.planStatusSubQuery = planStatusLookup;
|
||||
lookup.project = {
|
||||
fields: [
|
||||
nameof<Plan>(x => x.id),
|
||||
|
|
|
@ -35,7 +35,7 @@ export class PlanFilterDialogComponent implements OnInit {
|
|||
|
||||
private _buildPlanFilters(lookup: PlanLookup, references: ReferencesWithType[]): PlanListingFilters {
|
||||
return {
|
||||
status: lookup.statuses?.[0] ?? null,
|
||||
statusId: lookup.statusIds?.[0] ?? null,
|
||||
viewOnlyTenant: lookup.tenantSubQuery?.codes?.length > 0,
|
||||
descriptionTemplates: lookup.planDescriptionTemplateSubQuery?.descriptionTemplateGroupIds ? lookup.planDescriptionTemplateSubQuery?.descriptionTemplateGroupIds : [],
|
||||
planBlueprints: lookup.planBlueprintSubQuery?.ids ?? [],
|
||||
|
|
|
@ -9,11 +9,10 @@
|
|||
<!-- Visibility Filter-->
|
||||
<div *ngIf="!isPublic" class="col-10">
|
||||
<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-radio-button [value]="null" [checked]="formGroup.get('status')?.value == null" class="col-12">{{ 'PLAN-LISTING.FILTERS.STATUS.TYPE.ANY' | translate }}</mat-radio-button>
|
||||
<mat-radio-button [value]="status.Draft" class="col-12">{{ 'PLAN-LISTING.FILTERS.STATUS.TYPE.DRAFT' | translate }}</mat-radio-button>
|
||||
<mat-radio-button [value]="status.Finalized" class="col-12">{{ 'PLAN-LISTING.FILTERS.STATUS.TYPE.FINALIZED' | translate }}</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'PLAN-LISTING.FILTERS.STATUS.PLACEHOLDER' | translate }}</mat-label>
|
||||
<app-single-auto-complete [formControl]="formGroup.get('statusId')" [configuration]="planStatusAutoCompleteConfiguration"></app-single-auto-complete>
|
||||
</mat-form-field>
|
||||
<hr>
|
||||
</div>
|
||||
<!-- End of Visibility Filter-->
|
||||
|
|
|
@ -21,6 +21,7 @@ import { Reference } from '@app/core/model/reference/reference';
|
|||
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
||||
import { QueryResult } from '@common/model/query-result';
|
||||
import { ReferencesWithType } from '@app/core/query/description.lookup';
|
||||
import { PlanStatusService } from '@app/core/services/plan/plan-status.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-plan-filter-component',
|
||||
|
@ -56,6 +57,7 @@ export class PlanFilterComponent extends BaseCriteriaComponent<PlanListingFilter
|
|||
planBlueprintAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = this.planBlueprintService.multipleAutocompleteConfiguration;
|
||||
referenceTypeAutocompleteConfiguration: SingleAutoCompleteConfiguration = this.getReferenceTypeAutocompleteConfiguration();
|
||||
referenceAutocompleteConfiguration: Map<Guid, MultipleAutoCompleteConfiguration>;
|
||||
planStatusAutoCompleteConfiguration: SingleAutoCompleteConfiguration = this.planStatusService.singleAutocompleteConfiguration;
|
||||
|
||||
constructor(
|
||||
public language: TranslateService,
|
||||
|
@ -65,6 +67,7 @@ export class PlanFilterComponent extends BaseCriteriaComponent<PlanListingFilter
|
|||
private planBlueprintService: PlanBlueprintService,
|
||||
private referenceTypeService: ReferenceTypeService,
|
||||
private referenceService: ReferenceService,
|
||||
private planStatusService: PlanStatusService
|
||||
) {
|
||||
super(new ValidationErrorModel());
|
||||
}
|
||||
|
@ -75,7 +78,7 @@ export class PlanFilterComponent extends BaseCriteriaComponent<PlanListingFilter
|
|||
|
||||
buildForm(filters: PlanListingFilters){
|
||||
this.formGroup = new FormGroup<PlanListingFilterForm>({
|
||||
status: new FormControl(filters?.status),
|
||||
statusId: new FormControl(filters?.statusId),
|
||||
descriptionTemplates: new FormControl(filters?.descriptionTemplates),
|
||||
planBlueprints: new FormControl(filters?.planBlueprints),
|
||||
role: new FormControl(filters?.role),
|
||||
|
@ -110,7 +113,7 @@ export class PlanFilterComponent extends BaseCriteriaComponent<PlanListingFilter
|
|||
planBlueprints: null,
|
||||
references: null,
|
||||
role: null,
|
||||
status: null,
|
||||
statusId: null,
|
||||
viewOnlyTenant: null
|
||||
});
|
||||
this.referenceAutocompleteConfiguration.clear();
|
||||
|
@ -208,7 +211,7 @@ export class PlanFilterComponent extends BaseCriteriaComponent<PlanListingFilter
|
|||
}
|
||||
|
||||
export interface PlanListingFilters {
|
||||
status: PlanStatusEnum,
|
||||
statusId: Guid,
|
||||
viewOnlyTenant: boolean,
|
||||
descriptionTemplates: Guid[],
|
||||
planBlueprints: Guid[],
|
||||
|
@ -217,7 +220,7 @@ export interface PlanListingFilters {
|
|||
}
|
||||
|
||||
interface PlanListingFilterForm {
|
||||
status: FormControl<PlanStatusEnum>,
|
||||
statusId: FormControl<Guid>,
|
||||
viewOnlyTenant: FormControl<boolean>,
|
||||
descriptionTemplates: FormControl<Guid[]>,
|
||||
planBlueprints: FormControl<Guid[]>,
|
||||
|
|
|
@ -97,7 +97,7 @@ export class PlanListingComponent extends BaseListingComponent<BasePlan, PlanLoo
|
|||
return this.listingItems != null && this.listingItems.length > 0;
|
||||
}
|
||||
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.planBlueprintSubQuery != null || this.lookup.planUserSubQuery != null ||
|
||||
this.lookup.tenantSubQuery != null;
|
||||
|
@ -415,7 +415,7 @@ export class PlanListingComponent extends BaseListingComponent<BasePlan, PlanLoo
|
|||
|
||||
private _patchLookupFromFilters(filters: PlanListingFilters): PlanLookup {
|
||||
|
||||
this.lookup.statuses = filters?.status != null ? [filters.status] : null;
|
||||
this.lookup.statusIds = filters?.statusId != null ? [filters.statusId] : null;
|
||||
|
||||
// Tenants
|
||||
let viewOnlyTenant = filters?.viewOnlyTenant ?? false;
|
||||
|
@ -472,7 +472,7 @@ export class PlanListingComponent extends BaseListingComponent<BasePlan, PlanLoo
|
|||
private _countFilters(lookup: PlanLookup): number {
|
||||
let count = 0;
|
||||
|
||||
if (lookup.statuses) count += lookup.statuses.length;
|
||||
if (lookup.statusIds) count += lookup.statusIds.length;
|
||||
if (lookup.tenantSubQuery) count += 1;
|
||||
if (lookup.planDescriptionTemplateSubQuery) count += lookup.planDescriptionTemplateSubQuery.descriptionTemplateGroupIds?.length;
|
||||
if (lookup.planBlueprintSubQuery) count += lookup.planBlueprintSubQuery.ids?.length;
|
||||
|
|
|
@ -770,6 +770,7 @@
|
|||
"NO-ITEMS-FOUND": "Your search didn't match any items.",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPE": {
|
||||
"ANY": "Any",
|
||||
"PUBLIC": "Published",
|
||||
|
@ -1065,6 +1066,7 @@
|
|||
"RESET-FILTERS": "Reset",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPES": {
|
||||
"ANY": "Any",
|
||||
"DRAFT": "Draft",
|
||||
|
|
|
@ -770,6 +770,7 @@
|
|||
"NO-ITEMS-FOUND": "Your search didn't match any items.",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPE": {
|
||||
"ANY": "Any",
|
||||
"PUBLIC": "Published",
|
||||
|
@ -1065,6 +1066,7 @@
|
|||
"RESET-FILTERS": "Reset",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPES": {
|
||||
"ANY": "Any",
|
||||
"DRAFT": "Draft",
|
||||
|
|
|
@ -768,6 +768,7 @@
|
|||
"NO-ITEMS-FOUND": "Your search didn't match any items.",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPE": {
|
||||
"ANY": "Any",
|
||||
"PUBLIC": "Published",
|
||||
|
@ -1063,6 +1064,7 @@
|
|||
"RESET-FILTERS": "Reset",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPES": {
|
||||
"ANY": "Any",
|
||||
"DRAFT": "Draft",
|
||||
|
|
|
@ -770,6 +770,7 @@
|
|||
"NO-ITEMS-FOUND": "Your search didn't match any items.",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPE": {
|
||||
"ANY": "Any",
|
||||
"PUBLIC": "Published",
|
||||
|
@ -1065,6 +1066,7 @@
|
|||
"RESET-FILTERS": "Reset",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPES": {
|
||||
"ANY": "Any",
|
||||
"DRAFT": "Draft",
|
||||
|
|
|
@ -770,6 +770,7 @@
|
|||
"NO-ITEMS-FOUND": "Your search didn't match any items.",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPE": {
|
||||
"ANY": "Any",
|
||||
"PUBLIC": "Published",
|
||||
|
@ -1065,6 +1066,7 @@
|
|||
"RESET-FILTERS": "Reset",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPES": {
|
||||
"ANY": "Any",
|
||||
"DRAFT": "Draft",
|
||||
|
|
|
@ -770,6 +770,7 @@
|
|||
"NO-ITEMS-FOUND": "Your search didn't match any items.",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPE": {
|
||||
"ANY": "Any",
|
||||
"PUBLIC": "Published",
|
||||
|
@ -1065,6 +1066,7 @@
|
|||
"RESET-FILTERS": "Reset",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPES": {
|
||||
"ANY": "Any",
|
||||
"DRAFT": "Draft",
|
||||
|
|
|
@ -770,6 +770,7 @@
|
|||
"NO-ITEMS-FOUND": "Your search didn't match any items.",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPE": {
|
||||
"ANY": "Any",
|
||||
"PUBLIC": "Published",
|
||||
|
@ -1065,6 +1066,7 @@
|
|||
"RESET-FILTERS": "Reset",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPES": {
|
||||
"ANY": "Any",
|
||||
"DRAFT": "Draft",
|
||||
|
|
|
@ -770,6 +770,7 @@
|
|||
"NO-ITEMS-FOUND": "Your search didn't match any items.",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPE": {
|
||||
"ANY": "Any",
|
||||
"PUBLIC": "Published",
|
||||
|
@ -1065,6 +1066,7 @@
|
|||
"RESET-FILTERS": "Reset",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPES": {
|
||||
"ANY": "Any",
|
||||
"DRAFT": "Draft",
|
||||
|
|
|
@ -770,6 +770,7 @@
|
|||
"NO-ITEMS-FOUND": "Your search didn't match any items.",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPE": {
|
||||
"ANY": "Any",
|
||||
"PUBLIC": "Published",
|
||||
|
@ -1065,6 +1066,7 @@
|
|||
"RESET-FILTERS": "Reset",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPES": {
|
||||
"ANY": "Any",
|
||||
"DRAFT": "Draft",
|
||||
|
|
|
@ -770,6 +770,7 @@
|
|||
"NO-ITEMS-FOUND": "Your search didn't match any items.",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPE": {
|
||||
"ANY": "Any",
|
||||
"PUBLIC": "Published",
|
||||
|
@ -1065,6 +1066,7 @@
|
|||
"RESET-FILTERS": "Reset",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPES": {
|
||||
"ANY": "Any",
|
||||
"DRAFT": "Draft",
|
||||
|
|
|
@ -770,6 +770,7 @@
|
|||
"NO-ITEMS-FOUND": "Your search didn't match any items.",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPE": {
|
||||
"ANY": "Any",
|
||||
"PUBLIC": "Published",
|
||||
|
@ -1065,6 +1066,7 @@
|
|||
"RESET-FILTERS": "Reset",
|
||||
"STATUS": {
|
||||
"NAME": "Status",
|
||||
"PLACEHOLDER":"Select Status",
|
||||
"TYPES": {
|
||||
"ANY": "Any",
|
||||
"DRAFT": "Draft",
|
||||
|
|
Loading…
Reference in New Issue