use of org.adempiere.service.ClientId in project metasfresh-webui-api by metasfresh.
the class UserDashboardRepository method retrieveUserDashboardId.
private int retrieveUserDashboardId(final UserDashboardKey key) {
final ClientId adClientId = key.getAdClientId();
final int dashboardId = queryBL.createQueryBuilder(I_WEBUI_Dashboard.class).addOnlyActiveRecordsFilter().addInArrayFilter(I_WEBUI_Dashboard.COLUMN_AD_Client_ID, ClientId.SYSTEM, adClientId).orderBy().addColumn(I_WEBUI_Dashboard.COLUMN_AD_Client_ID, Direction.Descending, Nulls.Last).addColumn(I_WEBUI_Dashboard.COLUMN_IsDefault, Direction.Descending, Nulls.Last).addColumn(I_WEBUI_Dashboard.COLUMN_WEBUI_Dashboard_ID).endOrderBy().create().firstId();
return dashboardId > 0 ? dashboardId : -1;
}
use of org.adempiere.service.ClientId in project metasfresh-webui-api by metasfresh.
the class WEBUI_Fact_Acct_Repost_ViewRows method extractDocumentToRepostFromTableAndRecordIdRow.
private DocumentToRepost extractDocumentToRepostFromTableAndRecordIdRow(final IViewRow row) {
final int adTableId = row.getFieldValueAsInt(I_Fact_Acct.COLUMNNAME_AD_Table_ID, -1);
final int recordId = row.getFieldValueAsInt(I_Fact_Acct.COLUMNNAME_Record_ID, -1);
final ClientId adClientId = ClientId.ofRepoId(row.getFieldValueAsInt(I_Fact_Acct.COLUMNNAME_AD_Client_ID, -1));
return DocumentToRepost.builder().adTableId(adTableId).recordId(recordId).clientId(adClientId).build();
}
use of org.adempiere.service.ClientId in project metasfresh-webui-api by metasfresh.
the class WEBUI_Fact_Acct_Repost_ViewRows method extractDocumentToRepostFromRegularRow.
private DocumentToRepost extractDocumentToRepostFromRegularRow(final IViewRow row) {
final int adTableId = adTablesRepo.retrieveTableId(getTableName());
final int recordId = row.getId().toInt();
final ClientId adClientId = ClientId.ofRepoId(row.getFieldValueAsInt(I_Fact_Acct.COLUMNNAME_AD_Client_ID, -1));
return DocumentToRepost.builder().adTableId(adTableId).recordId(recordId).clientId(adClientId).build();
}
use of org.adempiere.service.ClientId in project metasfresh-webui-api by metasfresh.
the class SqlDocumentsRepository method retrieveNextDocumentId.
private static DocumentId retrieveNextDocumentId(final DocumentEntityDescriptor entityDescriptor) {
final SqlDocumentEntityDataBindingDescriptor dataBinding = SqlDocumentEntityDataBindingDescriptor.cast(entityDescriptor.getDataBinding());
final ClientId adClientId = UserSession.getCurrent().getClientId();
final String tableName = dataBinding.getTableName();
final int nextId = DB.getNextID(adClientId.getRepoId(), tableName, ITrx.TRXNAME_ThreadInherited);
if (nextId <= 0) {
throw new DBException("Cannot retrieve next ID from database for " + entityDescriptor);
}
logger.trace("Acquired next ID={} for {}", nextId, entityDescriptor);
return DocumentId.of(nextId);
}
use of org.adempiere.service.ClientId in project metasfresh-webui-api by metasfresh.
the class WEBUI_Fact_Acct_Repost_SingleDocument method extractDocumentToRepostFromSingleDocumentOrNull.
private DocumentToRepost extractDocumentToRepostFromSingleDocumentOrNull(final Document document) {
final BooleanWithReason allowReposting = checkAllowReposting(document);
if (allowReposting.isFalse()) {
throw new AdempiereException(allowReposting.getReason());
}
final String tableName = document.getEntityDescriptor().getTableName();
final int adTableId = adTablesRepo.retrieveTableId(tableName);
final int recordId = document.getDocumentIdAsInt();
final ClientId adClientId = document.getClientId();
return DocumentToRepost.builder().adTableId(adTableId).recordId(recordId).clientId(adClientId).build();
}
Aggregations