use of it.cnr.jada.DetailedException in project sigla-main by consiglionazionaledellericerche.
the class CRUDMissioneBP method initializeModelForEditAllegati.
@Override
public OggettoBulk initializeModelForEditAllegati(ActionContext actioncontext, OggettoBulk oggettobulk) throws BusinessProcessException {
MissioneBulk allegatoParentBulk = (MissioneBulk) oggettobulk;
try {
if (allegatoParentBulk.getIdRimborsoMissione() != null) {
List<StorageObject> files = missioniCMISService.getFilesOrdineMissione(allegatoParentBulk);
if (files != null) {
for (StorageObject storageObject : files) {
if (missioniCMISService.hasAspect(storageObject, StoragePropertyNames.SYS_ARCHIVED.value()))
continue;
if (excludeChild(storageObject))
continue;
if (storageObject.getPropertyValue(StoragePropertyNames.BASE_TYPE_ID.value()).equals(StoragePropertyNames.CMIS_DOCUMENT.value())) {
AllegatoMissioneBulk allegato = (AllegatoMissioneBulk) Introspector.newInstance(getAllegatoClass(), storageObject);
allegato.setContentType(storageObject.<String>getPropertyValue(StoragePropertyNames.CONTENT_STREAM_MIME_TYPE.value()));
allegato.setNome(storageObject.getPropertyValue(StoragePropertyNames.NAME.value()));
allegato.setDescrizione(storageObject.getPropertyValue(StoragePropertyNames.DESCRIPTION.value()));
allegato.setTitolo(storageObject.getPropertyValue(StoragePropertyNames.TITLE.value()));
completeAllegato(allegato, storageObject);
allegato.setCrudStatus(OggettoBulk.NORMAL);
allegatoParentBulk.addToArchivioAllegati(allegato);
}
}
}
List<StorageObject> filesRimborso = missioniCMISService.getFilesRimborsoMissione(allegatoParentBulk);
if (filesRimborso != null) {
for (StorageObject storageObject : filesRimborso) {
if (missioniCMISService.hasAspect(storageObject, StoragePropertyNames.SYS_ARCHIVED.value()))
continue;
if (excludeChild(storageObject))
continue;
recuperoAllegatiDettaglioMissioneSigla(allegatoParentBulk, storageObject);
if (storageObject.getPropertyValue(StoragePropertyNames.BASE_TYPE_ID.value()).equals(StoragePropertyNames.CMIS_DOCUMENT.value())) {
AllegatoMissioneBulk allegato = (AllegatoMissioneBulk) Introspector.newInstance(getAllegatoClass(), storageObject);
allegato.setContentType(storageObject.<String>getPropertyValue(StoragePropertyNames.CONTENT_STREAM_MIME_TYPE.value()));
allegato.setNome(storageObject.getPropertyValue(StoragePropertyNames.NAME.value()));
allegato.setDescrizione(storageObject.getPropertyValue(StoragePropertyNames.DESCRIPTION.value()));
allegato.setTitolo(storageObject.getPropertyValue(StoragePropertyNames.TITLE.value()));
completeAllegato(allegato, storageObject);
allegato.setCrudStatus(OggettoBulk.NORMAL);
allegatoParentBulk.addToArchivioAllegati(allegato);
}
}
}
if (allegatoParentBulk.getIdFlusso() != null) {
StorageObject storageObject = missioniCMISService.recuperoFlows(allegatoParentBulk.getIdFlusso());
if (storageObject != null) {
AllegatoMissioneBulk allegato = (AllegatoMissioneBulk) Introspector.newInstance(getAllegatoClass(), storageObject);
allegato.setContentType(storageObject.<String>getPropertyValue(StoragePropertyNames.CONTENT_STREAM_MIME_TYPE.value()));
allegato.setNome(storageObject.getPropertyValue(StoragePropertyNames.NAME.value()));
allegato.setDescrizione(storageObject.getPropertyValue(StoragePropertyNames.DESCRIPTION.value()));
allegato.setTitolo(storageObject.getPropertyValue(StoragePropertyNames.TITLE.value()));
allegato.setAspectName(AllegatoMissioneBulk.FLUSSO_RIMBORSO);
allegato.setCrudStatus(OggettoBulk.NORMAL);
allegatoParentBulk.addToArchivioAllegati(allegato);
}
}
if (allegatoParentBulk.getIdFlussoOrdineMissione() != null) {
StorageObject storageObject = missioniCMISService.recuperoFlows(allegatoParentBulk.getIdFlussoOrdineMissione());
if (storageObject != null) {
AllegatoMissioneBulk allegato = (AllegatoMissioneBulk) Introspector.newInstance(getAllegatoClass(), storageObject);
allegato.setContentType(storageObject.<String>getPropertyValue(StoragePropertyNames.CONTENT_STREAM_MIME_TYPE.value()));
allegato.setNome(storageObject.getPropertyValue(StoragePropertyNames.NAME.value()));
allegato.setDescrizione(storageObject.getPropertyValue(StoragePropertyNames.DESCRIPTION.value()));
allegato.setTitolo(storageObject.getPropertyValue(StoragePropertyNames.TITLE.value()));
allegato.setAspectName(AllegatoMissioneBulk.FLUSSO_ORDINE);
allegato.setCrudStatus(OggettoBulk.NORMAL);
allegatoParentBulk.addToArchivioAllegati(allegato);
}
}
} else {
List<StorageObject> files = missioniCMISService.getFilesMissioneSigla(allegatoParentBulk);
if (files != null) {
for (StorageObject storageObject : files) {
if (missioniCMISService.hasAspect(storageObject, StoragePropertyNames.SYS_ARCHIVED.value()))
continue;
if (excludeChild(storageObject))
continue;
recuperoAllegatiDettaglioMissioneSigla(allegatoParentBulk, storageObject);
if (storageObject.getPropertyValue(StoragePropertyNames.BASE_TYPE_ID.value()).equals(StoragePropertyNames.CMIS_DOCUMENT.value())) {
AllegatoMissioneBulk allegato = (AllegatoMissioneBulk) Introspector.newInstance(getAllegatoClass(), storageObject);
allegato.setContentType(storageObject.<String>getPropertyValue(StoragePropertyNames.CONTENT_STREAM_MIME_TYPE.value()));
allegato.setNome(storageObject.getPropertyValue(StoragePropertyNames.NAME.value()));
allegato.setDescrizione(storageObject.getPropertyValue(StoragePropertyNames.DESCRIPTION.value()));
allegato.setTitolo(storageObject.getPropertyValue(StoragePropertyNames.TITLE.value()));
completeAllegato(allegato, storageObject);
allegato.setCrudStatus(OggettoBulk.NORMAL);
allegatoParentBulk.addToArchivioAllegati(allegato);
}
}
}
}
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException | DetailedException e) {
throw handleException(e);
}
return oggettobulk;
}
use of it.cnr.jada.DetailedException in project sigla-main by consiglionazionaledellericerche.
the class ArchiviaStampaPdgVariazioneBP method initializeModelForEdit.
@Override
public OggettoBulk initializeModelForEdit(ActionContext actioncontext, OggettoBulk oggettobulk) throws BusinessProcessException {
final ArchiviaStampaPdgVariazioneBulk archiviaStampaPdgVariazioneBulk = Optional.ofNullable(oggettobulk).filter(ArchiviaStampaPdgVariazioneBulk.class::isInstance).map(ArchiviaStampaPdgVariazioneBulk.class::cast).orElseGet(() -> {
ArchiviaStampaPdgVariazioneBulk archiviaStampaPdgVariazione = new ArchiviaStampaPdgVariazioneBulk();
archiviaStampaPdgVariazione.setToBeUpdated();
archiviaStampaPdgVariazione.setPdg_variazioneForPrint((Pdg_variazioneBulk) oggettobulk);
return archiviaStampaPdgVariazione;
});
try {
final PdgVariazioneDocument pdgVariazioneDocument = Optional.ofNullable(archiviaStampaPdgVariazioneBulk.getPdgVariazioneDocument()).orElseGet(() -> {
return pdgVariazioniService.getPdgVariazioneDocument(archiviaStampaPdgVariazioneBulk);
});
archiviaStampaPdgVariazioneBulk.setPdgVariazioneDocument(pdgVariazioneDocument);
if (pdgVariazioneDocument.isSignedDocument())
archiviaStampaPdgVariazioneBulk.setTiSigned(ArchiviaStampaPdgVariazioneBulk.VIEW_SIGNED);
else
archiviaStampaPdgVariazioneBulk.setTiSigned(ArchiviaStampaPdgVariazioneBulk.VIEW_NOT_SIGNED);
archiviaStampaPdgVariazioneBulk.getArchivioAllegati().clear();
archiviaStampaPdgVariazioneBulk.getArchivioAllegati().addAll(Optional.ofNullable(getPath(archiviaStampaPdgVariazioneBulk)).map(path -> pdgVariazioniService.getStorageObjectByPath(path)).map(storageObject -> pdgVariazioniService.getChildren(storageObject.getKey())).map(storageObjects -> storageObjects.stream()).orElse(Stream.empty()).filter(storageObject -> !pdgVariazioniService.hasAspect(storageObject, StoragePropertyNames.SYS_ARCHIVED.value())).filter(storageObject -> !pdgVariazioneDocument.getStorageObject().getKey().equals(storageObject.getKey())).map(storageObject -> {
AllegatoPdGVariazioneDocumentBulk allegato = AllegatoPdGVariazioneDocumentBulk.construct(storageObject);
allegato.setContentType(storageObject.<String>getPropertyValue(StoragePropertyNames.CONTENT_STREAM_MIME_TYPE.value()));
allegato.setNome(storageObject.<String>getPropertyValue(StoragePropertyNames.NAME.value()));
allegato.setDescrizione(storageObject.<String>getPropertyValue(StoragePropertyNames.DESCRIPTION.value()));
allegato.setTitolo(storageObject.<String>getPropertyValue(StoragePropertyNames.TITLE.value()));
allegato.setCrudStatus(OggettoBulk.NORMAL);
return allegato;
}).collect(Collectors.toList()));
} catch (DetailedException e) {
handleException(e);
}
return archiviaStampaPdgVariazioneBulk;
}
Aggregations