use of de.metas.i18n.ITranslatableString in project metasfresh-webui-api by metasfresh.
the class PPOrderLinesLoader method extractDescription.
private static final ITranslatableString extractDescription(final I_PP_Order ppOrder) {
final ITranslatableString docTypeStr;
final I_C_DocType docType = ppOrder.getC_DocType();
if (docType != null) {
final IModelTranslationMap docTypeTrlMap = InterfaceWrapperHelper.getModelTranslationMap(docType);
docTypeStr = docTypeTrlMap.getColumnTrl(I_C_DocType.COLUMNNAME_Name, docType.getName());
} else {
docTypeStr = ImmutableTranslatableString.empty();
}
final ITranslatableString documentNoStr = ImmutableTranslatableString.constant(ppOrder.getDocumentNo());
return ITranslatableString.compose(" ", docTypeStr, documentNoStr);
}
use of de.metas.i18n.ITranslatableString in project metasfresh-webui-api by metasfresh.
the class BoardDescriptorRepository method createCard.
private BoardCard createCard(final ResultSet rs, final BoardDescriptor boardDescriptor) throws SQLException {
final String adLanguage = null;
final int laneId = rs.getInt(I_WEBUI_Board_RecordAssignment.COLUMNNAME_WEBUI_Board_Lane_ID);
final int recordId = rs.getInt(I_WEBUI_Board_RecordAssignment.COLUMNNAME_Record_ID);
final String caption = rs.getString("card$caption");
final int userId = rs.getInt("card$user_id");
final String userAvatarId = rs.getString("card$user_avatar_id");
final String userFullname = rs.getString("card$user_fullname");
//
// Retrieve card fields
final Map<String, Object> cardValues = new LinkedHashMap<>();
for (final BoardCardFieldDescriptor cardField : boardDescriptor.getCardFields()) {
final BoardFieldLoader fieldLoader = cardField.getFieldLoader();
final Object fieldValue = fieldLoader.retrieveValueAsJson(rs, adLanguage);
if (fieldValue == null) {
continue;
}
cardValues.put(cardField.getFieldName(), fieldValue);
}
final ITranslatableString description = buildDescription(cardValues, boardDescriptor);
return BoardCard.builder().cardId(recordId).laneId(laneId).caption(ImmutableTranslatableString.constant(caption)).description(description).documentPath(DocumentPath.rootDocumentPath(boardDescriptor.getDocumentWindowId(), DocumentId.of(recordId))).user(BoardCardUser.builder().userId(userId).avatarId(userAvatarId).fullname(userFullname).build()).build();
}
use of de.metas.i18n.ITranslatableString in project metasfresh-webui-api by metasfresh.
the class DocumentFilterDescriptorsProviderFactory method createFilterParam.
private final DocumentFilterParamDescriptor.Builder createFilterParam(final DocumentFieldDescriptor field) {
final ITranslatableString displayName = field.getCaption();
final String fieldName = field.getFieldName();
final DocumentFieldWidgetType widgetType = extractFilterWidgetType(field);
final DocumentFieldDefaultFilterDescriptor filteringInfo = field.getDefaultFilterInfo();
final LookupDescriptor lookupDescriptor = field.getLookupDescriptor(LookupDescriptorProvider.LookupScope.DocumentFilter);
final Operator operator;
if (widgetType.isText()) {
operator = Operator.LIKE_I;
} else if (filteringInfo.isRangeFilter()) {
operator = Operator.BETWEEN;
} else {
operator = Operator.EQUAL;
}
return DocumentFilterParamDescriptor.builder().setDisplayName(displayName).setFieldName(fieldName).setWidgetType(widgetType).setOperator(operator).setLookupDescriptor(lookupDescriptor).setMandatory(false).setShowIncrementDecrementButtons(filteringInfo.isShowFilterIncrementButtons()).setAutoFilterInitialValue(filteringInfo.getAutoFilterInitialValue());
}
use of de.metas.i18n.ITranslatableString in project metasfresh-webui-api by metasfresh.
the class HUsToPickViewBasedProcess method checkPreconditionsApplicable.
@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable() {
final Optional<HUEditorRow> anyHU = retrieveEligibleHUEditorRows().findAny();
if (anyHU.isPresent()) {
return ProcessPreconditionsResolution.accept();
}
final ITranslatableString reason = Services.get(IMsgBL.class).getTranslatableMsgText(MSG_WEBUI_SELECT_ACTIVE_UNSELECTED_HU);
return ProcessPreconditionsResolution.reject(reason);
}
use of de.metas.i18n.ITranslatableString in project metasfresh-webui-api by metasfresh.
the class HUReportProcessInstancesRepository method toWebuiHUProcessDescriptor.
private WebuiHUProcessDescriptor toWebuiHUProcessDescriptor(final HUProcessDescriptor huProcessDescriptor) {
final int reportADProcessId = huProcessDescriptor.getProcessId();
final ProcessId processId = ProcessId.of(PROCESS_HANDLER_TYPE, reportADProcessId);
final I_AD_Process adProcess = Services.get(IADProcessDAO.class).retrieveProcessById(reportADProcessId);
final IModelTranslationMap adProcessTrl = InterfaceWrapperHelper.getModelTranslationMap(adProcess);
final ITranslatableString caption = adProcessTrl.getColumnTrl(I_AD_Process.COLUMNNAME_Name, adProcess.getName());
final ITranslatableString description = adProcessTrl.getColumnTrl(I_AD_Process.COLUMNNAME_Description, adProcess.getDescription());
final DocumentEntityDescriptor parametersDescriptor = DocumentEntityDescriptor.builder().setDocumentType(DocumentType.Process, processId.toDocumentId()).setCaption(caption).setDescription(description).disableDefaultTableCallouts().addField(DocumentFieldDescriptor.builder(HUReportProcessInstance.PARAM_Copies).setCaption(Services.get(IMsgBL.class).translatable(HUReportProcessInstance.PARAM_Copies)).setWidgetType(DocumentFieldWidgetType.Integer)).build();
return WebuiHUProcessDescriptor.builder().huProcessDescriptor(huProcessDescriptor).processDescriptor(ProcessDescriptor.builder().setProcessId(processId).setType(ProcessDescriptorType.Report).setParametersDescriptor(parametersDescriptor).setLayout(ProcessLayout.builder().setProcessId(processId).setCaption(caption).setDescription(description).addElements(parametersDescriptor).build()).build()).build();
}
Aggregations