Search in sources :

Example 6 with MHRConcept

use of org.eevolution.model.MHRConcept in project adempiere by adempiere.

the class HRCreateConcept method updatingConceptProperties.

/**
	 * Update Concept Properties
	 * @param concepts
	 * @return
	 */
private int updatingConceptProperties(List<MHRConcept> concepts, int payrollId) {
    AtomicInteger count = new AtomicInteger(0);
    concepts.stream().filter(concept -> concept != null).forEach(concept -> {
        Optional.ofNullable(getSelectionAsString(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_Name)).ifPresent(name -> concept.setName(name));
        Optional.ofNullable(getSelectionAsString(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_Description)).ifPresent(description -> concept.setDescription(description));
        Optional.ofNullable(getSelectionAsInt(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_HR_Concept_Category_ID)).ifPresent(categoryId -> concept.setHR_Concept_Category_ID(categoryId));
        Optional.ofNullable(getSelectionAsInt(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_HR_Concept_Type_ID)).ifPresent(typeId -> concept.setHR_Concept_Type_ID(typeId));
        Optional.ofNullable(getSelectionAsInt(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_SeqNo)).ifPresent(seqNo -> concept.setSeqNo(seqNo));
        Optional.ofNullable(getSelectionAsString(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_Type)).ifPresent(type -> concept.setType(type));
        Optional.ofNullable(getSelectionAsString(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_ColumnType)).ifPresent(columnType -> concept.setColumnType(columnType));
        Optional.ofNullable(getSelectionAsString(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_AccountSign)).ifPresent(accountSign -> concept.setAccountSign(accountSign));
        Optional.ofNullable(getSelectionAsBoolean(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_IsActive)).ifPresent(isActive -> concept.setIsActive(isActive));
        Optional.ofNullable(getSelectionAsBoolean(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_IsEmployee)).ifPresent(isEmployee -> concept.setIsEmployee(isEmployee));
        Optional.ofNullable(getSelectionAsBoolean(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_IsManual)).ifPresent(isManual -> concept.setIsManual(isManual));
        Optional.ofNullable(getSelectionAsBoolean(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_IsPaid)).ifPresent(isPaid -> concept.setIsPaid(isPaid));
        Optional.ofNullable(getSelectionAsBoolean(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_IsPrepayment)).ifPresent(isPrepayment -> concept.setIsPrepayment(isPrepayment));
        Optional.ofNullable(getSelectionAsBoolean(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_IsInvoiced)).ifPresent(isInvoiced -> concept.setIsInvoiced(isInvoiced));
        Optional.ofNullable(getSelectionAsBoolean(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_IsSaveInHistoric)).ifPresent(isSaveInHistoric -> concept.setIsSaveInHistoric(isSaveInHistoric));
        Optional.ofNullable(getSelectionAsBoolean(concept.get_ID(), getPrefixAliasForTableSelection() + MHRConcept.COLUMNNAME_IsPrinted)).ifPresent(isPrint -> concept.setIsPrinted(isPrint));
        if (concept.is_Changed()) {
            count.updateAndGet(no -> no + 1);
            concept.saveEx();
            addLog("@Updated@ @HR_Concept_ID@ : " + concept.getName());
        }
    });
    return count.get();
}
Also used : List(java.util.List) Query(org.compiere.model.Query) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) MHRConcept(org.eevolution.model.MHRConcept) Optional(java.util.Optional) MHRPayrollConcept(org.eevolution.model.MHRPayrollConcept) AtomicInteger(java.util.concurrent.atomic.AtomicInteger)

Aggregations

MHRConcept (org.eevolution.model.MHRConcept)6 MHRMovement (org.eevolution.model.MHRMovement)3 BigDecimal (java.math.BigDecimal)2 Timestamp (java.sql.Timestamp)2 List (java.util.List)2 Optional (java.util.Optional)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Query (org.compiere.model.Query)2 KeyNamePair (org.compiere.util.KeyNamePair)2 MHRPayrollConcept (org.eevolution.model.MHRPayrollConcept)2 MHRPeriod (org.eevolution.model.MHRPeriod)2 MHRProcess (org.eevolution.model.MHRProcess)2 ActionEvent (java.awt.event.ActionEvent)1 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 ValueNamePair (org.compiere.util.ValueNamePair)1 X_I_HR_Movement (org.eevolution.model.X_I_HR_Movement)1