Sostituiti controlli su size == 0 con isEmpty() sulle liste

This commit is contained in:
Giuseppe Scorrano 2025-02-04 09:55:34 +01:00
parent d4a7dee121
commit 998b1057e0
47 changed files with 95 additions and 95 deletions

View File

@ -85,7 +85,7 @@ public class BarcodeManager {
private static BarcodeCallbackDTO getValidCallback() {
if (mBarcodeCallbacksStacktrace.size() > 0) {
if (!mBarcodeCallbacksStacktrace.isEmpty()) {
return mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() - 1);
} else {
return null;
@ -106,7 +106,7 @@ public class BarcodeManager {
int newID = -1;
if (mBarcodeCallbacksStacktrace.size() > 0) {
if (!mBarcodeCallbacksStacktrace.isEmpty()) {
newID = mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() - 1).getID() + 1;
} else {
newID = 1;

View File

@ -30,7 +30,7 @@ public class DataCache {
Object foundDataCache = null;
if(dataCacheTemp != null && dataCacheTemp.size() > 0) {
if(dataCacheTemp != null && !dataCacheTemp.isEmpty()) {
foundDataCache = dataCacheTemp.get(0).getItem();
dataCacheList.remove(dataCacheTemp.get(0));
}

View File

@ -46,7 +46,7 @@ public class ColliDataRecoverService {
}
public boolean thereIsAnExistantSession() {
return mtbColtsSessions != null && mtbColtsSessions.size() > 0;
return mtbColtsSessions != null && !mtbColtsSessions.isEmpty();
}
public List<Integer> getAllSessionIDs() {

View File

@ -354,7 +354,7 @@ public class Converters {
view.addTextChangedListener(watcher);
}
BigDecimal newValue = bindableBigDecimal.get();
BigDecimal viewValue = view.getText().toString().trim().length() > 0 ? new BigDecimal(view.getText().toString()) : null;
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null;
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
view.setText(UtilityNumber.decimalToString(newValue));
@ -381,7 +381,7 @@ public class Converters {
view.addTextChangedListener(watcher);
}
Integer newValue = bindableInteger.get();
Integer viewValue = view.getText().toString().trim().length() > 0 ? Integer.valueOf(view.getText().toString()) : Integer.valueOf(0);
Integer viewValue = !view.getText().toString().trim().isEmpty() ? Integer.valueOf(view.getText().toString()) : Integer.valueOf(0);
if (!(viewValue.compareTo(newValue) == 0)) {
view.setText(newValue.toString());
@ -432,7 +432,7 @@ public class Converters {
view.addTextChangedListener(watcher);
}
Integer newValue = observableInteger.get();
Integer viewValue = view.getText().toString().trim().length() > 0 ? Integer.valueOf(view.getText().toString()) : Integer.valueOf(0);
Integer viewValue = !view.getText().toString().trim().isEmpty() ? Integer.valueOf(view.getText().toString()) : Integer.valueOf(0);
if (!viewValue.equals(newValue) && newValue != null) {
view.setText(newValue.toString());
@ -459,7 +459,7 @@ public class Converters {
view.addTextChangedListener(watcher);
}
Long newValue = observableLong.get();
Long viewValue = view.getText().toString().trim().length() > 0 ? Long.valueOf(view.getText().toString()) : Long.valueOf(0);
Long viewValue = !view.getText().toString().trim().isEmpty() ? Long.valueOf(view.getText().toString()) : Long.valueOf(0);
if (!viewValue.equals(newValue) && newValue != null) {
view.setText(newValue.toString());

View File

@ -66,19 +66,19 @@ public class Ean128Service {
switch (aiModel.AI) {
case SSCC -> {
if (aiValue.length() > 0 && (aiValue.charAt(0) == '0' || aiValue.charAt(0) == '9')) {
if (!aiValue.isEmpty() && (aiValue.charAt(0) == '0' || aiValue.charAt(0) == '9')) {
aiValue = new StringBuilder(aiValue.substring(1));
}
model.Sscc = aiValue.toString();
}
case GTIN -> {
if (aiValue.length() > 0 && (aiValue.charAt(0) == '0' || aiValue.charAt(0) == '9')) {
if (!aiValue.isEmpty() && (aiValue.charAt(0) == '0' || aiValue.charAt(0) == '9')) {
aiValue = new StringBuilder(aiValue.substring(1));
}
model.Gtin = aiValue.toString();
}
case CONTENT -> {
if (aiValue.length() > 0 && (aiValue.charAt(0) == '0' || aiValue.charAt(0) == '9')) {
if (!aiValue.isEmpty() && (aiValue.charAt(0) == '0' || aiValue.charAt(0) == '9')) {
aiValue = new StringBuilder(aiValue.substring(1));
}
model.Content = aiValue.toString();

View File

@ -327,7 +327,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
ArticoloRESTConsumer.getByCodMartsStatic(codMarts, arts -> {
if (arts != null && arts.size() > 0) {
if (arts != null && !arts.isEmpty()) {
for (MtbColt mtbColt : mtbColts) {
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
@ -336,7 +336,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
List<MtbAart> mtbAartStream = Stream.of(arts)
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart())).toList();
if (mtbAartStream != null && mtbAartStream.size() > 0) {
if (mtbAartStream != null && !mtbAartStream.isEmpty()) {
foundMtbAart = mtbAartStream.get(0);
}
@ -392,7 +392,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
analyzeAnswer(response, "getColloInGiac", mtbColt -> {
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
List<MtbColt> mtbColtList = new ArrayList<>();
mtbColtList.add(mtbColt);
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);

View File

@ -190,7 +190,7 @@ public class SettingsManager {
mSystemRESTConsumer.getAvailableCodMdeps(availableCodMdeps -> {
dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
if (availableCodMdeps == null || availableCodMdeps.size() == 0) {
if (availableCodMdeps == null || availableCodMdeps.isEmpty()) {
onFailed.run(new Exception(mContext.getText(R.string.no_codmdep_available).toString()));
return;
}

View File

@ -51,7 +51,7 @@ public class PermissionsHelper {
boolean allGranted = Stream.of(grantResults).allMatch(x -> x == PackageManager.PERMISSION_GRANTED);
// If request is cancelled, the result arrays are empty.
if (grantResults.size() > 0 && allGranted) {
if (!grantResults.isEmpty() && allGranted) {
onPermissionsConfirmed.run();
} else {

View File

@ -88,7 +88,7 @@ public class UtilityLogger {
}
return callerNew.length() > 0 ? callerNew.toString() : caller;
return !callerNew.isEmpty() ? callerNew.toString() : caller;
}

View File

@ -37,7 +37,7 @@ public class UtilityPosizione {
List<MtbDepoPosizione> tmpList = Stream.of(availablePosizioni)
.filter(x -> x.getPosizione().equalsIgnoreCase(posizione)).toList();
if(tmpList.size() > 0) return tmpList.get(0);
if(!tmpList.isEmpty()) return tmpList.get(0);
else return null;
}

View File

@ -377,7 +377,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
//Calc Num CNF
BigDecimal numCnfEvasa = BigDecimal.ZERO;
if (x.getWithdrawMtbColrs().size() > 0) {
if (!x.getWithdrawMtbColrs().isEmpty()) {
numCnfEvasa = Stream.of(x.getWithdrawMtbColrs())
.map(MtbColr::getNumCnf)
.reduce(BigDecimal.ZERO, BigDecimal::add);
@ -386,7 +386,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
//Calc qta col
BigDecimal qtaEvasa = BigDecimal.ZERO;
if (x.getWithdrawMtbColrs().size() > 0) {
if (!x.getWithdrawMtbColrs().isEmpty()) {
qtaEvasa = Stream.of(x.getWithdrawMtbColrs())
.map(MtbColr::getQtaCol)
.reduce(BigDecimal.ZERO, BigDecimal::add);

View File

@ -286,7 +286,7 @@ public class AccettazioneBollaPickingViewModel {
private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) {
this.mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
if (mtbAartList != null && mtbAartList.size() > 0) {
if (mtbAartList != null && !mtbAartList.isEmpty()) {
this.searchArtFromAnag(mtbAartList.get(0), pickData, onComplete);
} else {
this.manageUnknownBarcode(barcodeProd, onComplete);
@ -310,7 +310,7 @@ public class AccettazioneBollaPickingViewModel {
}
private void loadMatchedRows(List<PickingObjectDTO> matchedRows, MtbAart mtbAart, PickDataDTO pickDataDTO) {
if (matchedRows == null || matchedRows.size() == 0) {
if (matchedRows == null || matchedRows.isEmpty()) {
manageNoArtFound(mtbAart, pickDataDTO);
} else if (matchedRows.size() == 1) {
this.manageDispatchBollaRow(matchedRows.get(0));

View File

@ -414,14 +414,14 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
//Calc Num CNF
BigDecimal numCnfEvasa = BigDecimal.ZERO;
if (x.getWithdrawMtbColrs().size() > 0) {
if (!x.getWithdrawMtbColrs().isEmpty()) {
numCnfEvasa = Stream.of(x.getWithdrawMtbColrs()).map(MtbColr::getNumCnf).reduce(BigDecimal.ZERO, BigDecimal::add);
}
//Calc qta col
BigDecimal qtaEvasa = BigDecimal.ZERO;
if (x.getWithdrawMtbColrs().size() > 0) {
if (!x.getWithdrawMtbColrs().isEmpty()) {
qtaEvasa = Stream.of(x.getWithdrawMtbColrs()).map(MtbColr::getQtaCol).reduce(BigDecimal.ZERO, BigDecimal::add);
}
@ -472,14 +472,14 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
//Calc Num CNF
BigDecimal numCnfEvasa = BigDecimal.ZERO;
if (x.getWithdrawMtbColrs().size() > 0) {
if (!x.getWithdrawMtbColrs().isEmpty()) {
numCnfEvasa = Stream.of(x.getWithdrawMtbColrs()).map(MtbColr::getNumCnf).reduce(BigDecimal.ZERO, BigDecimal::add);
}
//Calc qta col
BigDecimal qtaEvasa = BigDecimal.ZERO;
if (x.getWithdrawMtbColrs().size() > 0) {
if (!x.getWithdrawMtbColrs().isEmpty()) {
qtaEvasa = Stream.of(x.getWithdrawMtbColrs()).map(MtbColr::getQtaCol).reduce(BigDecimal.ZERO, BigDecimal::add);
}
@ -527,14 +527,14 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
//Calc Num CNF
BigDecimal numCnfEvasa = BigDecimal.ZERO;
if (x.getWithdrawMtbColrs().size() > 0) {
if (!x.getWithdrawMtbColrs().isEmpty()) {
numCnfEvasa = Stream.of(x.getWithdrawMtbColrs()).map(MtbColr::getNumCnf).reduce(BigDecimal.ZERO, BigDecimal::add);
}
//Calc qta col
BigDecimal qtaEvasa = BigDecimal.ZERO;
if (x.getWithdrawMtbColrs().size() > 0) {
if (!x.getWithdrawMtbColrs().isEmpty()) {
qtaEvasa = Stream.of(x.getWithdrawMtbColrs()).map(MtbColr::getQtaCol).reduce(BigDecimal.ZERO, BigDecimal::add);
}
@ -583,14 +583,14 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
//Calc Num CNF
BigDecimal numCnfEvasa = BigDecimal.ZERO;
if (x.getWithdrawMtbColrs().size() > 0) {
if (!x.getWithdrawMtbColrs().isEmpty()) {
numCnfEvasa = Stream.of(x.getWithdrawMtbColrs()).map(MtbColr::getNumCnf).reduce(BigDecimal.ZERO, BigDecimal::add);
}
//Calc qta col
BigDecimal qtaEvasa = BigDecimal.ZERO;
if (x.getWithdrawMtbColrs().size() > 0) {
if (!x.getWithdrawMtbColrs().isEmpty()) {
qtaEvasa = Stream.of(x.getWithdrawMtbColrs()).map(MtbColr::getQtaCol).reduce(BigDecimal.ZERO, BigDecimal::add);
}

View File

@ -369,7 +369,7 @@ public class AccettazioneOrdiniPickingViewModel {
private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) {
this.mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
if (mtbAartList != null && mtbAartList.size() > 0) {
if (mtbAartList != null && !mtbAartList.isEmpty()) {
this.searchArtFromAnag(mtbAartList.get(0), pickData, onComplete);
} else {
this.sendError(new NoResultFromBarcodeException(barcodeProd));

View File

@ -208,13 +208,13 @@ public class OrdiniUscitaElencoViewModel {
private void executeEtichettaLU(String SSCC, RunnableArgs<List<OrdiniUscitaElencoDTO>> onComplete) {
this.mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
if (mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) {
//GET BY COMMESSA COLLO
this.mOrdiniUscitaElencoRESTConsumer.getOrdiniFromCommessaCollo(mCurrentCodMdep, mtbColt, orderList -> {
if (orderList != null && orderList.size() > 0) {
if (orderList != null && !orderList.isEmpty()) {
List<Integer> numOrds = Stream.of(orderList)
.map(DtbOrdt::getNumOrd)
.toList();

View File

@ -247,12 +247,12 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
initAdapter();
thereIsAnOpenedUL.set(true);
thereIsAnyRowInUL.set(mtbColt.getMtbColr().size() > 0, true);
thereIsAnyRowInUL.set(!mtbColt.getMtbColr().isEmpty(), true);
mtbColt.getMtbColr().addOnListChangedCallback(new OnListGeneralChangedCallback() {
@Override
public void onChanged(ObservableList sender) {
thereIsAnyRowInUL.set(mtbColt.getMtbColr().size() > 0, true);
thereIsAnyRowInUL.set(!mtbColt.getMtbColr().isEmpty(), true);
}
});

View File

@ -215,7 +215,7 @@ public class PickingLiberoViewModel {
private void executePosizione(MtbDepoPosizione posizione, MtbAart articolo, Runnable onComplete) {
this.mPosizioniRESTConsumer.getBancaliInPosizione(posizione, mtbColtList -> {
if (mtbColtList == null || mtbColtList.size() == 0) {
if (mtbColtList == null || mtbColtList.isEmpty()) {
if (articolo != null) {
this.dispatchArt(articolo, null);
} else {
@ -298,7 +298,7 @@ public class PickingLiberoViewModel {
private void loadArticolo(String barcodeProd, Ean128Model ean128Model, Runnable onComplete) {
mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
if (mtbAartList != null && mtbAartList.size() > 0) {
if (mtbAartList != null && !mtbAartList.isEmpty()) {
MtbAart articolo = mtbAartList.get(0);
MtbDepoPosizione posizione = UtilityPosizione.getFromCache(articolo.getPosizione());
@ -730,7 +730,7 @@ public class PickingLiberoViewModel {
MtbColr mtbColrRif = null;
if (mtbColrRifs != null && mtbColrRifs.size() > 0) {
if (mtbColrRifs != null && !mtbColrRifs.isEmpty()) {
//TODO: Da capire se è necessario controllare anche il cod_jcom
mtbColrRif = Stream.of(mtbColrRifs)
.filter(x -> UtilityString.equalsIgnoreCase(x.getCodMart(), mtbColrToUpdate.getCodMart()) &&

View File

@ -332,7 +332,7 @@ public class PickingResiViewModel {
private void executeEtichettaLU(String SSCC, Runnable onComplete) {
mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
if (mtbColt.getSegno() != -1) {
searchArtFromUL(mtbColt, onComplete);
} else this.sendError(new InvalidLUException());
@ -420,7 +420,7 @@ public class PickingResiViewModel {
private void loadMatchedRows(List<WithdrawableDtbDocr> matchedRows) {
if (matchedRows == null || matchedRows.size() == 0) {
if (matchedRows == null || matchedRows.isEmpty()) {
this.sendError(new NoResultFromBarcodeException());
} else if (matchedRows.size() == 1) {
WithdrawableDtbDocr matchedItem = matchedRows.get(0);
@ -464,7 +464,7 @@ public class PickingResiViewModel {
MtbColr mtbColrToDispatch = withdrawableDtbDocr.getTempPickData() != null &&
withdrawableDtbDocr.getTempPickData().getSourceMtbColt() != null &&
withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getMtbColr() != null &&
withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getMtbColr().size() > 0 ?
!withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getMtbColr().isEmpty() ?
withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getMtbColr().get(0) : null;
BigDecimal totalAvailableQtaCol;
@ -553,7 +553,7 @@ public class PickingResiViewModel {
MtbColr mtbColrToDispatch = withdrawableDtbDocr.getTempPickData() != null &&
withdrawableDtbDocr.getTempPickData().getSourceMtbColt() != null &&
withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getMtbColr() != null &&
withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getMtbColr().size() > 0 ?
!withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getMtbColr().isEmpty() ?
withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getMtbColr().get(0) : null;
if (mtbColrToDispatch != null) {
@ -593,7 +593,7 @@ public class PickingResiViewModel {
boolean shouldPrint = true;
//Se è l'unico articolo del collo (controllo se è uguale a 0 perché ancora non è stato aggiunto nella lista delle righe)
if (shouldCloseLU && mCurrentMtbColt.getMtbColr().size() == 0) {
if (shouldCloseLU && mCurrentMtbColt.getMtbColr().isEmpty()) {
shouldPrint = false;
}

View File

@ -56,7 +56,7 @@ public class PickingResiRESTConsumer {
Type typeOfObjectsList = new TypeToken<ArrayList<WithdrawableDtbDocr>>() {}.getType();
this.mSystemRestConsumer.<ArrayList<WithdrawableDtbDocr>>processSql(sql, typeOfObjectsList, values -> {
if(values != null && values.size() > 0){
if(values != null && !values.isEmpty()){
List<String> codMarts = Stream.of(values)
.map(DtbDocr::getCodMart)
.withoutNulls()
@ -65,7 +65,7 @@ public class PickingResiRESTConsumer {
mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> {
if(arts != null && arts.size() > 0) {
if(arts != null && !arts.isEmpty()) {
for (DtbDocr value : values) {
MtbAart foundMtbAart = null;
@ -73,7 +73,7 @@ public class PickingResiRESTConsumer {
List<MtbAart> mtbAartStream = Stream.of(arts)
.filter(x -> x.getCodMart().equalsIgnoreCase(value.getCodMart())).toList();
if(mtbAartStream != null && mtbAartStream.size() > 0){
if(mtbAartStream != null && !mtbAartStream.isEmpty()){
foundMtbAart = mtbAartStream.get(0);
}

View File

@ -99,7 +99,7 @@ public class ProdDettaglioLineaViewModel {
private void checkOrdersCompatibility(MtbColt mtbColt, Runnable onComplete) {
mesRESTConsumer.getOrdiniLavorazioneMateriale(lineaProd.getValue().getCodJfas(), getIdMaterialeFromCollo(mtbColt), ordini -> {
if (ordini != null && ordini.size() > 0) {
if (ordini != null && !ordini.isEmpty()) {
onComplete.run();
} else {
this.mListener.confirmInconsistentDeposit(onComplete);

View File

@ -70,7 +70,7 @@ public class DialogAskMagazzinoProssimitaAdapter extends ArrayAdapter<JtbFasi> i
}
}
if (prefix == null || prefix.length() == 0) {
if (prefix == null || prefix.isEmpty()) {
synchronized (lock) {
results.values = mDatasetAllItems;
results.count = mDatasetAllItems.size();

View File

@ -287,7 +287,7 @@ public class ProdRecuperoMaterialeRESTConsumer extends _BaseRESTConsumer {
List<MtbAart> mtbAartStream = Stream.of(arts)
.filter(x -> x.getCodMart().equalsIgnoreCase(value.getCodMart())).toList();
if (mtbAartStream != null && mtbAartStream.size() > 0) {
if (mtbAartStream != null && !mtbAartStream.isEmpty()) {
foundMtbAart = mtbAartStream.get(0);
}

View File

@ -255,12 +255,12 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
.mapToInt(x -> x.getOriginalOrdineLavorazione().getHrNum())
.sum();
if (selectedOrders.size() > 0 && totalHr <= 0) {
if (!selectedOrders.isEmpty() && totalHr <= 0) {
this.onError(new Exception("Il totale delle <b>risorse umane</b> è pari a 0"));
return;
}
fabVisible.set(selectedOrders.size() > 0);
fabVisible.set(!selectedOrders.isEmpty());
for (VersamentoMerceOrdineLavListModel versamentoMerceOrdineLavListModel : this.mCurrentOrders) {
versamentoMerceOrdineLavListModel.setNumCnfBigDecimal(BigDecimal.ZERO);
@ -304,7 +304,7 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
}
if (selectedOrders.size() > 0) {
if (!selectedOrders.isEmpty()) {
VersamentoMerceOrdineLavListModel majorOrder =
Stream.of(selectedOrders)
.max((o1, o2) -> Integer.compare(o1.getOriginalOrdineLavorazione().getHrNum(), o2.getOriginalOrdineLavorazione().getHrNum())).get();
@ -334,7 +334,7 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
.map(VersamentoMerceOrdineLavListModel::getOriginalOrdineLavorazione)
.toList();
if (selectedOrders.size() > 0) {
if (!selectedOrders.isEmpty()) {
this.mViewModel.save(selectedOrders);
} else {
Toast.makeText(requireActivity(), "Nessun ordine selezionato!", Toast.LENGTH_SHORT).show();

View File

@ -106,7 +106,7 @@ public class ProdVersamentoMaterialeViewModel {
private void executePosizione(MtbDepoPosizione posizione) {
this.mPosizioniRESTConsumer.getBancaliInPosizione(posizione, mtbColtList -> {
if (mtbColtList == null || mtbColtList.size() == 0) {
if (mtbColtList == null || mtbColtList.isEmpty()) {
this.sendError(new NoLUFoundException());
} else if (mtbColtList.size() == 1) {
this.mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
@ -172,7 +172,7 @@ public class ProdVersamentoMaterialeViewModel {
private void loadArticolo(String barcodeProd, Ean128Model ean128Model) {
mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
if (mtbAartList != null && mtbAartList.size() > 0) {
if (mtbAartList != null && !mtbAartList.isEmpty()) {
MtbAart articolo = mtbAartList.get(0);
this.dispatchArt(articolo, ean128Model);

View File

@ -76,7 +76,7 @@ public class ProdVersamentoMaterialeInBufferFragment extends BaseFragment implem
mtbColt.getGestioneEnum() == GestioneEnum.VENDITA) &&
mtbColt.getSegno() == 1) {
if (mtbColt.getMtbColr() == null || mtbColt.getMtbColr().size() == 0) {
if (mtbColt.getMtbColr() == null || mtbColt.getMtbColr().isEmpty()) {
DialogSimpleMessageView.makeWarningDialog(
new SpannableString(Html.fromHtml("E' stata scansionata una UL già vuota")),
null, this::openLU)

View File

@ -109,9 +109,9 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
this.mViewModel.getArticoli().observe(this, articoli -> {
mBinding.countArtOrd.setText(String.valueOf(articoli.size()));
mBinding.pvOrdineExport.setVisibility(articoli.size() > 0 ? View.INVISIBLE : View.GONE);
mBinding.pvOrdineExport.setVisibility(!articoli.isEmpty() ? View.INVISIBLE : View.GONE);
mBinding.closeActivityFab.close(false);
mBinding.scanArtSpinner.setVisibility(articoli.size() > 0 ? View.GONE : View.VISIBLE);
mBinding.scanArtSpinner.setVisibility(!articoli.isEmpty() ? View.GONE : View.VISIBLE);
if (ordine.isOrderNewProducts() && articoli.isEmpty() && isOrderNewProdsForced()) {
this.mViewModel.orderNewProducts();

View File

@ -187,7 +187,7 @@ public class PVOrdiniAcquistoGrigliaFragment extends BaseFragment implements ITi
}
private void setOrdini(List<OrdineWrapper> ordini) {
mBinding.ordiniAApertiMainList.setVisibility(ordini != null && ordini.size() > 0 ? View.VISIBLE : View.GONE);
mBinding.ordiniAApertiMainList.setVisibility(ordini != null && !ordini.isEmpty() ? View.VISIBLE : View.GONE);
mBinding.ordiniAEmptyView.setVisibility(ordini == null || ordini.size() <= 0 ? View.VISIBLE : View.GONE);
refreshRenderedOrdini(ordini);
mAdapter.updateItems(mRenderedOrderList);

View File

@ -369,7 +369,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
}
boolean anyLUPresent = x.getMtbColts() != null && x.getMtbColts().size() > 0;
boolean anyLUPresent = x.getMtbColts() != null && !x.getMtbColts().isEmpty();
spedizioneListModel.setActive(mEnableFakeGiacenza || anyLUPresent);
@ -422,7 +422,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
cloneModel.setGroupTitle(String.format("%s: %s", getString(R.string.position_text), UtilityString.isNullOrEmpty(mtbColtToPick.getPosizione()) ? "N.A." : mtbColtToPick.getPosizione()));
MtbColr mtbColrToDispatch = mtbColtToPick.getMtbColr() != null && mtbColtToPick.getMtbColr().size() > 0 ? mtbColtToPick.getMtbColr().get(0) : null;
MtbColr mtbColrToDispatch = mtbColtToPick.getMtbColr() != null && !mtbColtToPick.getMtbColr().isEmpty() ? mtbColtToPick.getMtbColr().get(0) : null;
if (mtbColrToDispatch != null) {
if (!UtilityString.isNullOrEmpty(mtbColrToDispatch.getPartitaMag()))
cloneModel.setSubDescrizione1(String.format(getString(R.string.batch_lot_text), mtbColrToDispatch.getPartitaMag()));
@ -539,7 +539,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
}
boolean anyLUPresent = x.getMtbColts() != null && x.getMtbColts().size() > 0;
boolean anyLUPresent = x.getMtbColts() != null && !x.getMtbColts().isEmpty();
spedizioneListModel.setActive(mEnableFakeGiacenza || anyLUPresent);
@ -595,7 +595,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
SpedizioneListModel cloneModel = (SpedizioneListModel) spedizioneListModel.clone();
MtbColr mtbColrToDispatch = mtbColtToPick.getMtbColr() != null && mtbColtToPick.getMtbColr().size() > 0 ? mtbColtToPick.getMtbColr().get(0) : null;
MtbColr mtbColrToDispatch = mtbColtToPick.getMtbColr() != null && !mtbColtToPick.getMtbColr().isEmpty() ? mtbColtToPick.getMtbColr().get(0) : null;
if (mtbColrToDispatch != null) {
if (!UtilityString.isNullOrEmpty(mtbColrToDispatch.getPartitaMag()))
cloneModel.setSubDescrizione1(String.format(getString(R.string.batch_lot_text), mtbColrToDispatch.getPartitaMag()));

View File

@ -614,7 +614,7 @@ public class SpedizioneViewModel {
}
mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
boolean codMdepIsValid = SettingsManager.iDB().getAvailableCodMdep().stream()
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
@ -636,7 +636,7 @@ public class SpedizioneViewModel {
private void executeEtichettaLU(String SSCC, Runnable onComplete) {
mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
if (mtbColt.getSegno() != -1) {
boolean codMdepIsValid = SettingsManager.iDB().getAvailableCodMdep().stream()
@ -1135,7 +1135,7 @@ public class SpedizioneViewModel {
private void loadProductLotStatus(String codMart, String partitaMag, RunnableArgs<StatoArticoloDTO> onComplete) {
this.sendOnLoadingStarted();
this.mArticoloRESTConsumer.getStatoPartita(codMart, partitaMag, stati -> {
onComplete.run(stati.size() > 0 ? stati.get(0) : null);
onComplete.run(!stati.isEmpty() ? stati.get(0) : null);
}, this::sendError);
}
@ -1306,7 +1306,7 @@ public class SpedizioneViewModel {
MtbColr mtbColrRif = null;
if (mtbColrRifs != null && mtbColrRifs.size() > 0) {
if (mtbColrRifs != null && !mtbColrRifs.isEmpty()) {
//TODO: Da capire se è necessario controllare anche il cod_jcom
Optional<MtbColr> optionalMtbColr =
mtbColrRifs.stream()
@ -1407,10 +1407,10 @@ public class SpedizioneViewModel {
final MtbColr mtbColrToDispatch = pickingObjectDTO.getTempPickData() != null &&
pickingObjectDTO.getTempPickData().getSourceMtbColt() != null &&
pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr() != null &&
pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().size() > 0 ?
!pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().isEmpty() ?
pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().get(0) : null;
boolean shouldPrint = !shouldCloseLU || mCurrentMtbColt.getMtbColr().size() != 0;
boolean shouldPrint = !shouldCloseLU || !mCurrentMtbColt.getMtbColr().isEmpty();
//Se è l'unico articolo del collo (controllo se è uguale a 0 perché ancora non è stato aggiunto nella lista delle righe)
if (UtilityBigDecimal.equalsTo(numCnf, BigDecimal.ZERO) && UtilityBigDecimal.equalsTo(qtaTot, BigDecimal.ZERO)) {

View File

@ -197,7 +197,7 @@ public class UltimeConsegneClienteFragment extends BaseFragment implements Ultim
.forEach(x -> x.setSelected(false));
}
if (selectedOrders != null && selectedOrders.size() > 0) {
if (selectedOrders != null && !selectedOrders.isEmpty()) {
mBindings.mainFab.show();
} else {
mBindings.mainFab.hide();

View File

@ -92,7 +92,7 @@ public class UltimeConsegneClienteViewModel {
private void executeEtichettaLU(String SSCC, RunnableArgs<List<OrdiniUscitaElencoDTO>> onComplete) {
this.mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
if(mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
if(mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
// if(mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) {
// //GET BY COMMESSA COLLO

View File

@ -199,7 +199,7 @@ public class UltimiArriviFornitoreFragment extends BaseFragment implements ITitl
.forEach(x -> x.setSelected(false));
}
if (selectedOrders != null && selectedOrders.size() > 0) {
if (selectedOrders != null && !selectedOrders.isEmpty()) {
mBindings.mainFab.show();
} else {
mBindings.mainFab.hide();

View File

@ -93,7 +93,7 @@ public class UltimiArriviFornitoreViewModel {
private void executeEtichettaLU(String SSCC, Runnable onComplete) {
this.mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
if(mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
if(mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
if(mtbColt.getSegno() > 0) {
this.sendOnMtbColtScanned(mtbColt);

View File

@ -45,7 +45,7 @@ public class UltimiArriviFornitoreRESTConsumer {
public void getUltimeConsegneFornitori(String codMdep, String codAnag, List<MtbAart> mtbAarts, int limitConsegnePerCli, int limitDays, RunnableArgs<ArrayList<DocumentoResoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
String codMarts = null;
if (mtbAarts != null && mtbAarts.size() > 0) {
if (mtbAarts != null && !mtbAarts.isEmpty()) {
codMarts = StringUtils.join(Stream.of(mtbAarts)
.map(MtbAart::getCodMart)
.toList(), "|");

View File

@ -130,7 +130,7 @@ public class VersamentoMerceViewModel {
private void executePosizioneMonocollo(Runnable onComplete, MtbDepoPosizione foundPosizione) {
this.mPosizioniRESTConsumer.getBancaliInPosizione(foundPosizione, mtbColtList -> {
if (mtbColtList == null || mtbColtList.size() == 0) {
if (mtbColtList == null || mtbColtList.isEmpty()) {
this.sendError(new NoLUFoundException());
} else if (mtbColtList.size() == 1) {
mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {

View File

@ -247,7 +247,7 @@ public class StatusBarAlert {
break label48;
}
if (var9.size() != 0) {
if (!var9.isEmpty()) {
break label48;
}
}

View File

@ -124,7 +124,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
List<DialogAskClienteClienteDTO> resultCodAnag = Stream.of(availableClienti)
.filter(x -> barcode.equalsIgnoreCase(x.getCodAnag()))
.toList();
if (resultCodAnag.size() > 0) {
if (!resultCodAnag.isEmpty()) {
return resultCodAnag.get(0);
} else return null;
}
@ -133,7 +133,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
List<DialogAskClienteClienteDTO> resultCodJcom = Stream.of(availableClienti)
.filter(x -> x.getCodJcoms().contains(barcode))
.toList();
if (resultCodJcom.size() > 0) {
if (!resultCodJcom.isEmpty()) {
return resultCodJcom.get(0);
} else return null;
}
@ -182,7 +182,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
private boolean validateCliente() {
if (SettingsManager.iDB().isFlagPickLiberoAllowEmptyCliente() && mBinding.inputCliente.getEditText().getText().toString().trim().length() == 0) {
if (SettingsManager.iDB().isFlagPickLiberoAllowEmptyCliente() && mBinding.inputCliente.getEditText().getText().toString().trim().isEmpty()) {
return true;
} else return getCurrentCliente() != null;
}

View File

@ -72,7 +72,7 @@ public class DialogAskCliente_Page1_Cliente_ArrayAdapter extends ArrayAdapter<Di
}
}
if (prefix == null || prefix.length() == 0) {
if (prefix == null || prefix.isEmpty()) {
synchronized (lock) {
results.values = mDatasetAllItems;
results.count = mDatasetAllItems.size();

View File

@ -67,7 +67,7 @@ public class DialogAskCliente_Page1_Commessa_ArrayAdapter extends ArrayAdapter<S
}
}
if (prefix == null || prefix.length() == 0) {
if (prefix == null || prefix.isEmpty()) {
synchronized (lock) {
results.values = mDatasetAllItems;
results.count = mDatasetAllItems.size();

View File

@ -53,7 +53,7 @@ public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewMod
: null;
if (filteredDestinatari == null || filteredDestinatari.size() == 0) {
if (filteredDestinatari == null || filteredDestinatari.isEmpty()) {
mOnConfirm.run();
return;
}

View File

@ -89,7 +89,7 @@ public class DialogAskCliente_Page2_ArrayAdapter extends ArrayAdapter<DialogAskC
}
}
if (prefix == null || prefix.length() == 0) {
if (prefix == null || prefix.isEmpty()) {
synchronized (lock) {
results.values = mDatasetAllItems;
results.count = mDatasetAllItems.size();

View File

@ -49,9 +49,9 @@ public class DialogBasketLU_Page1_ViewModel extends DialogBasketLU_BaseViewModel
ColliMagazzinoRESTConsumer.retrieveBasketColli(mtbColts -> {
availableMtbColts = mtbColts;
if(mtbColts != null && mtbColts.size() > 0) initRecyclerView(availableMtbColts);
if(mtbColts != null && !mtbColts.isEmpty()) initRecyclerView(availableMtbColts);
mBinding.emptyView.setVisibility(mtbColts != null && mtbColts.size() > 0 ? View.GONE : View.VISIBLE);
mBinding.emptyView.setVisibility(mtbColts != null && !mtbColts.isEmpty() ? View.GONE : View.VISIBLE);
}, ex -> {
mBinding.emptyView.setVisibility(View.VISIBLE);
});

View File

@ -46,8 +46,8 @@ public class DialogBasketLU_Page2_ViewModel extends DialogBasketLU_BaseViewModel
@Override
public void onPreShow() {
if(mMtbColt != null && mMtbColt.getMtbColr() != null && mMtbColt.getMtbColr().size() > 0) initRecyclerView(mMtbColt.getMtbColr());
mBinding.emptyView.setVisibility(mMtbColt != null && mMtbColt.getMtbColr() != null && mMtbColt.getMtbColr().size() > 0 ? View.GONE : View.VISIBLE);
if(mMtbColt != null && mMtbColt.getMtbColr() != null && !mMtbColt.getMtbColr().isEmpty()) initRecyclerView(mMtbColt.getMtbColr());
mBinding.emptyView.setVisibility(mMtbColt != null && mMtbColt.getMtbColr() != null && !mMtbColt.getMtbColr().isEmpty() ? View.GONE : View.VISIBLE);
mBinding.buttonAbort.setOnClickListener(v -> {
previous();

View File

@ -296,7 +296,7 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
private void loadArticolo(String barcodeProd, Ean128Model ean128Model) {
this.articoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
if (mtbAartList != null && mtbAartList.size() > 0) {
if (mtbAartList != null && !mtbAartList.isEmpty()) {
MtbAart articolo = mtbAartList.get(0);
this.mBindings.mainSearch.setQuery(articolo.getCodMart(), false);
@ -320,7 +320,7 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
!x.isHidden())
.toList();
if (foundRowsList.size() == 0) {
if (foundRowsList.isEmpty()) {
DialogCommon.showNoArtFoundDialog(mContext, null);
} else {

View File

@ -347,8 +347,8 @@ public class DialogInputLUProdView extends BaseDialogFragment implements DialogI
this.mViewModel.getLineeProd().observe(getViewLifecycleOwner(), lineeProd -> {
this.enabledLineeProd.set(lineeProd != null && lineeProd.size() > 0);
this.mViewModel.setLineeProdRequired(lineeProd != null && lineeProd.size() > 0);
this.enabledLineeProd.set(lineeProd != null && !lineeProd.isEmpty());
this.mViewModel.setLineeProdRequired(lineeProd != null && !lineeProd.isEmpty());
lineeProdArrayAdapter = new DialogInputLULineeProdAdapter(getActivity(), R.layout.array_adapter_single_item, lineeProd);
mBindings.filledExposedDropdownCodJfas.setAdapter(lineeProdArrayAdapter);

View File

@ -129,7 +129,7 @@ public class DialogScanArtViewModel {
private void executeEtichettaLU(String SSCC, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
if (mtbColt.getSegno() != -1) {
onComplete.run(DialogConsts.Results.YES, null, null, mtbColt.getMtbColr());
} else this.sendError(new InvalidLUException());
@ -164,7 +164,7 @@ public class DialogScanArtViewModel {
private void executePosizione(MtbDepoPosizione posizione, MtbAart articolo, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
this.mPosizioniRESTConsumer.getBancaliInPosizione(posizione, mtbColtList -> {
if (mtbColtList == null || mtbColtList.size() == 0) {
if (mtbColtList == null || mtbColtList.isEmpty()) {
this.sendError(new NoLUFoundException());
} else if (mtbColtList.size() == 1) {
this.mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
@ -180,7 +180,7 @@ public class DialogScanArtViewModel {
private void loadArticolo(@NotNull String barcodeProd, Ean128Model ean128Model, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
this.mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
if (mtbAartList != null && mtbAartList.size() > 0) {
if (mtbAartList != null && !mtbAartList.isEmpty()) {
MtbAart firstArt = mtbAartList.get(0);
MtbDepoPosizione firstArtPosition = UtilityPosizione.getFromCache(firstArt.getPosizione());

View File

@ -95,7 +95,7 @@ public class DialogScanOrCreateLUViewModel {
private void executePosizione(MtbDepoPosizione posizione, Runnable onComplete) {
this.mPosizioniRESTConsumer.getBancaliInPosizione(posizione, mtbColtList -> {
if (mtbColtList == null || mtbColtList.size() == 0) {
if (mtbColtList == null || mtbColtList.isEmpty()) {
this.sendError(new NoLUFoundException());
} else if (mtbColtList.size() == 1) {
this.mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), mShouldCheckResiduo, false, mtbColt -> {