export plan, description status

This commit is contained in:
CITE\amentis 2024-09-23 17:41:27 +03:00
parent fb9fca2277
commit 8732479769
6 changed files with 98 additions and 0 deletions

View File

@ -22,6 +22,9 @@ public class DescriptionImportExport {
@XmlElement(name = "label")
private String label;
@XmlElement(name = "status")
private DescriptionStatusImportExport status;
@XmlElement(name = "finalizedAt")
@XmlJavaTypeAdapter(InstantXmlAdapter.class)
private Instant finalizedAt;
@ -67,6 +70,14 @@ public class DescriptionImportExport {
this.label = label;
}
public DescriptionStatusImportExport getStatus() {
return status;
}
public void setStatus(DescriptionStatusImportExport status) {
this.status = status;
}
public Instant getFinalizedAt() {
return this.finalizedAt;
}

View File

@ -0,0 +1,26 @@
package org.opencdmp.commons.types.description.importexport;
import java.util.UUID;
public class DescriptionStatusImportExport {
private UUID id;
private String name;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -30,6 +30,9 @@ public class PlanImportExport {
@XmlElement(name = "access")
private PlanAccessType access;
@XmlElement(name = "status")
private PlanStatusImportExport status;
@XmlElement(name = "version")
private Short version;
@ -109,6 +112,14 @@ public class PlanImportExport {
this.access = access;
}
public PlanStatusImportExport getStatus() {
return status;
}
public void setStatus(PlanStatusImportExport status) {
this.status = status;
}
public List<PlanContactImportExport> getContacts() {
return this.contacts;
}

View File

@ -0,0 +1,26 @@
package org.opencdmp.commons.types.plan.importexport;
import java.util.UUID;
public class PlanStatusImportExport {
private UUID id;
private String name;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -1253,6 +1253,7 @@ public class DescriptionServiceImpl implements DescriptionService {
xml.setId(data.getId());
xml.setDescription(data.getDescription());
xml.setLabel(data.getLabel());
xml.setStatus(this.descriptionStatusImportExportToExport(data.getStatusId()));
xml.setFinalizedAt(data.getFinalizedAt());
PlanDescriptionTemplateEntity planDescriptionTemplateEntity = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().ids(data.getPlanDescriptionTemplateId()).authorize(AuthorizationFlags.All).isActive(IsActive.Active).first();
@ -1289,6 +1290,17 @@ public class DescriptionServiceImpl implements DescriptionService {
return xml;
}
private DescriptionStatusImportExport descriptionStatusImportExportToExport(UUID statusId) throws InvalidApplicationException {
DescriptionStatusImportExport xml = new DescriptionStatusImportExport();
if (statusId == null) return xml;
DescriptionStatusEntity statusEntity = this.entityManager.find(DescriptionStatusEntity.class, statusId, true);
if (statusEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{statusId, DescriptionStatusEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
xml.setId(statusEntity.getId());
xml.setName(statusEntity.getName());
return xml;
}
private DescriptionReferenceImportExport descriptionReferenceToExport(DescriptionReferenceEntity entity, Map<UUID, ReferenceEntity> referenceEntityMap, Map<UUID, ReferenceTypeEntity> referenceTypeEntityMap) {
DescriptionReferenceImportExport xml = new DescriptionReferenceImportExport();
if (entity == null) return xml;

View File

@ -2142,6 +2142,7 @@ public class PlanServiceImpl implements PlanService {
xml.setTitle(data.getLabel());
xml.setLanguage(data.getLanguage());
xml.setAccess(data.getAccessType());
xml.setStatus(this.planStatusImportExportToExport(data.getStatusId()));
xml.setFinalizedAt(data.getFinalizedAt());
xml.setPublicAfter(data.getPublicAfter());
xml.setVersion(data.getVersion());
@ -2155,6 +2156,17 @@ public class PlanServiceImpl implements PlanService {
return xml;
}
private PlanStatusImportExport planStatusImportExportToExport(UUID statusId) throws InvalidApplicationException {
PlanStatusImportExport xml = new PlanStatusImportExport();
if (statusId == null) return xml;
PlanStatusEntity planStatusEntity = this.entityManager.find(PlanStatusEntity.class, statusId, true);
if (planStatusEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{statusId, PlanStatusEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
xml.setId(planStatusEntity.getId());
xml.setName(planStatusEntity.getName());
return xml;
}
private List<DescriptionImportExport> descriptionsToExport(PlanEntity data, Boolean isPublic) throws JAXBException, InvalidApplicationException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException {
List<DescriptionEntity> descriptions;