use of de.metas.ui.web.exceptions.EntityNotFoundException in project metasfresh-webui-api by metasfresh.
the class DocumentAttachments method getEntry.
public IDocumentAttachmentEntry getEntry(final DocumentId id) {
final IPair<String, Integer> prefixAndId = toPrefixAndEntryId(id);
final String idPrefix = prefixAndId.getLeft();
final int entryId = prefixAndId.getRight();
if (ID_PREFIX_Attachment.equals(idPrefix)) {
final AttachmentEntry entry = attachmentsBL.getEntryById(recordRef, entryId);
if (entry == null) {
throw new EntityNotFoundException(id.toJson());
}
return DocumentAttachmentEntry.of(id, entry);
} else if (ID_PREFIX_Archive.equals(idPrefix)) {
final I_AD_Archive archive = Services.get(IArchiveDAO.class).retrieveArchiveOrNull(Env.getCtx(), recordRef, entryId);
if (archive == null) {
throw new EntityNotFoundException(id.toJson());
}
return DocumentArchiveEntry.of(id, archive);
} else {
throw new EntityNotFoundException(id.toJson());
}
}
use of de.metas.ui.web.exceptions.EntityNotFoundException in project metasfresh-webui-api by metasfresh.
the class ADProcessDescriptorsFactory method retrieveProcessDescriptor.
private ProcessDescriptor retrieveProcessDescriptor(final ProcessId processId) {
final I_AD_Process adProcess = InterfaceWrapperHelper.create(Env.getCtx(), processId.getProcessIdAsInt(), I_AD_Process.class, ITrx.TRXNAME_None);
if (adProcess == null) {
throw new EntityNotFoundException("@NotFound@ @AD_Process_ID@ (" + processId + ")");
}
final WebuiProcessClassInfo webuiProcesClassInfo = WebuiProcessClassInfo.of(adProcess.getClassname());
final IModelTranslationMap adProcessTrlsMap = InterfaceWrapperHelper.getModelTranslationMap(adProcess);
//
// Parameters document descriptor
final DocumentEntityDescriptor parametersDescriptor;
{
final DocumentEntityDescriptor.Builder parametersDescriptorBuilder = DocumentEntityDescriptor.builder().setDocumentType(DocumentType.Process, processId.toDocumentId()).setCaption(adProcessTrlsMap.getColumnTrl(I_AD_Process.COLUMNNAME_Name, adProcess.getName())).setDescription(adProcessTrlsMap.getColumnTrl(I_AD_Process.COLUMNNAME_Description, adProcess.getDescription())).setDataBinding(ProcessParametersDataBindingDescriptorBuilder.instance).disableDefaultTableCallouts();
// Get AD_Process_Para(s) and populate the entity descriptor
adProcessDAO.retrieveProcessParameters(adProcess).stream().map(adProcessParam -> createProcessParaDescriptor(webuiProcesClassInfo, adProcessParam)).forEach(processParaDescriptor -> parametersDescriptorBuilder.addField(processParaDescriptor));
parametersDescriptor = parametersDescriptorBuilder.build();
}
//
// Parameters layout
final ProcessLayout.Builder layout = ProcessLayout.builder().setProcessId(processId).setLayoutType(webuiProcesClassInfo.getLayoutType()).setCaption(parametersDescriptor.getCaption()).setDescription(parametersDescriptor.getDescription()).addElements(parametersDescriptor);
// Process descriptor
return ProcessDescriptor.builder().setProcessId(processId).setType(extractType(adProcess)).setProcessClassname(extractClassnameOrNull(adProcess)).setParametersDescriptor(parametersDescriptor).setLayout(layout.build()).build();
}
use of de.metas.ui.web.exceptions.EntityNotFoundException in project metasfresh-webui-api by metasfresh.
the class DebugRestController method getLoggersUpToRoot.
@GetMapping("/logger/{loggerName}/_getUpToRoot")
public List<Map<String, Object>> getLoggersUpToRoot(@PathVariable("loggerName") final String loggerName) {
final Logger logger = LogManager.getLogger(loggerName);
if (logger == null) {
throw new EntityNotFoundException("No logger found for " + loggerName);
}
final List<Map<String, Object>> loggerInfos = new ArrayList<>();
//
LogManager.forAllLevelsUpToRoot(logger, currentLogger -> {
final Map<String, Object> info = new HashMap<>();
info.put("name", currentLogger.getName());
info.put("id", System.identityHashCode(currentLogger));
if (currentLogger instanceof ch.qos.logback.classic.Logger) {
final ch.qos.logback.classic.Logger logbackLogger = (ch.qos.logback.classic.Logger) currentLogger;
final Level level = logbackLogger.getLevel();
final Level effectiveLevel = logbackLogger.getEffectiveLevel();
info.put("level", level == null ? null : level.toString());
info.put("level-effective", effectiveLevel == null ? null : effectiveLevel.toString());
} else {
info.put("warning", "unknown level for logger object " + currentLogger + " (" + currentLogger.getClass() + ")");
}
loggerInfos.add(info);
});
//
return loggerInfos;
}
use of de.metas.ui.web.exceptions.EntityNotFoundException in project metasfresh-webui-api by metasfresh.
the class ViewProcessInstancesRepository method getActionInstance.
private ViewActionInstance getActionInstance(final DocumentId pinstanceId) {
final String viewId = ViewActionInstancesList.extractViewId(pinstanceId);
final ViewActionInstancesList viewActionInstancesList = viewActionInstancesByViewId.get(viewId);
if (viewActionInstancesList == null) {
throw new EntityNotFoundException("No view action instance found for " + pinstanceId);
}
return viewActionInstancesList.getByInstanceId(pinstanceId);
}
Aggregations