use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class QuickInputDescriptorFactoryService method hasQuickInputEntityDescriptor.
public boolean hasQuickInputEntityDescriptor(@NonNull final DocumentEntityDescriptor includedDocumentDescriptor) {
final DocumentType documentType = includedDocumentDescriptor.getDocumentType();
final DocumentId documentTypeId = includedDocumentDescriptor.getDocumentTypeId();
final String tableName = includedDocumentDescriptor.getTableNameOrNull();
final DetailId detailId = includedDocumentDescriptor.getDetailId();
final Optional<Boolean> soTrx = includedDocumentDescriptor.getIsSOTrx();
return getQuickInputEntityDescriptorOrNull(documentType, documentTypeId, tableName, detailId, soTrx) != null;
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class QuickInputPath method of.
public static final //
QuickInputPath of(//
final String windowIdStr, //
final String documentIdStr, //
final String tabIdStr, //
final String quickInputIdStr) {
final DocumentPath rootDocumentPath = DocumentPath.rootDocumentPath(WindowId.fromJson(windowIdStr), documentIdStr);
final DetailId detailId = DetailId.fromJson(tabIdStr);
final DocumentId quickInputId = DocumentId.of(quickInputIdStr);
return new QuickInputPath(rootDocumentPath, detailId, quickInputId);
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class JSONCreateProcessInstanceRequest method createSelectedIncludedDocumentPaths.
private static final List<DocumentPath> createSelectedIncludedDocumentPaths(final WindowId windowId, final String documentIdStr, final JSONSelectedIncludedTab selectedTab) {
if (windowId == null || Check.isEmpty(documentIdStr, true) || selectedTab == null) {
return ImmutableList.of();
}
final DocumentId documentId = DocumentId.of(documentIdStr);
final DetailId selectedTabId = DetailId.fromJson(selectedTab.getTabId());
return selectedTab.getRowIds().stream().map(DocumentId::of).map(rowId -> DocumentPath.includedDocumentPath(windowId, documentId, selectedTabId, rowId)).collect(ImmutableList.toImmutableList());
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class SqlViewDataRepository method loadViewRow.
private ViewRow.Builder loadViewRow(final ResultSet rs, final WindowId windowId, final String adLanguage) throws SQLException {
final boolean isRecordMissing = DisplayType.toBoolean(rs.getString(SqlViewSelectData.COLUMNNAME_IsRecordMissing));
if (isRecordMissing) {
return null;
}
final ViewRow.Builder viewRowBuilder = ViewRow.builder(windowId);
final DocumentId parentRowId = keyColumnNamesMap.retrieveRowId(rs, SqlViewSelectData.COLUMNNAME_Paging_Parent_Prefix, false);
if (parentRowId != null) {
viewRowBuilder.setParentRowId(parentRowId);
viewRowBuilder.setType(DefaultRowType.Line);
} else {
viewRowBuilder.setType(DefaultRowType.Row);
}
final DocumentId rowId = retrieveRowId(rs, adLanguage);
if (rowId == null) {
logger.warn("No ID found for current row. Skipping the row.");
return null;
}
viewRowBuilder.setRowId(rowId);
for (final Map.Entry<String, SqlViewRowFieldLoader> fieldNameAndLoader : rowFieldLoaders.entrySet()) {
final String fieldName = fieldNameAndLoader.getKey();
final SqlViewRowFieldLoader fieldLoader = fieldNameAndLoader.getValue();
final Object value = fieldLoader.retrieveValueAsJson(rs, adLanguage);
viewRowBuilder.putFieldValue(fieldName, value);
}
if (rowCustomizer != null) {
rowCustomizer.customizeViewRow(viewRowBuilder);
}
return viewRowBuilder;
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class SqlViewRowIdsOrderedSelectionFactory method retrieveRowIdsForLineIds.
public static Set<DocumentId> retrieveRowIdsForLineIds(@NonNull SqlViewKeyColumnNamesMap keyColumnNamesMap, final ViewId viewId, final Set<Integer> lineIds) {
final SqlAndParams sqlAndParams = SqlViewSelectionQueryBuilder.buildSqlSelectRowIdsForLineIds(keyColumnNamesMap, viewId.getViewId(), lineIds);
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = DB.prepareStatement(sqlAndParams.getSql(), ITrx.TRXNAME_ThreadInherited);
DB.setParameters(pstmt, sqlAndParams.getSqlParams());
rs = pstmt.executeQuery();
final ImmutableSet.Builder<DocumentId> rowIds = ImmutableSet.builder();
while (rs.next()) {
final DocumentId rowId = keyColumnNamesMap.retrieveRowId(rs, "", false);
rowIds.add(rowId);
}
return rowIds.build();
} catch (final SQLException ex) {
throw new DBException(ex, sqlAndParams.getSql(), sqlAndParams.getSqlParams());
} finally {
DB.close(rs, pstmt);
}
}
Aggregations