Search in sources :

Example 6 with LookUpValueLocaleEntity

use of org.mifos.application.master.business.LookUpValueLocaleEntity in project head by mifos.

the class LegacyMasterDao method updateValueListElementForLocale.

/**
     * Update the String value of a LookUpValueLocaleEntity.
     *
     * @param lookupValueEntityId
     *            - the database id of the LookUpValueLocaleEntity object
     *            representing a ValueListElement
     */
public void updateValueListElementForLocale(final Integer lookupValueEntityId, final String newValue) throws PersistenceException {
    LookUpValueEntity lookupValueEntity = getPersistentObject(LookUpValueEntity.class, lookupValueEntityId);
    Set<LookUpValueLocaleEntity> lookUpValueLocales = lookupValueEntity.getLookUpValueLocales();
    if (lookUpValueLocales != null) {
        for (LookUpValueLocaleEntity entity : lookUpValueLocales) {
            if (entity.getLookUpId().equals(lookupValueEntityId)) {
                entity.setLookUpValue(newValue);
                createOrUpdate(entity);
                ApplicationContextProvider.getBean(MessageLookup.class).updateLookupValueInCache(lookupValueEntity.getLookUpName(), newValue);
                StaticHibernateUtil.commitTransaction();
                break;
            }
        }
    }
}
Also used : MessageLookup(org.mifos.application.master.MessageLookup) LookUpValueLocaleEntity(org.mifos.application.master.business.LookUpValueLocaleEntity) LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity)

Example 7 with LookUpValueLocaleEntity

use of org.mifos.application.master.business.LookUpValueLocaleEntity in project head by mifos.

the class ApplicationConfigurationDaoHibernate method findLookupValues.

@Override
@SuppressWarnings("unchecked")
public List<LookUpValueEntity> findLookupValues() {
    List<LookUpValueEntity> values = null;
    Session session = StaticHibernateUtil.getSessionTL();
    values = session.getNamedQuery(NamedQueryConstants.GET_LOOKUPVALUES).list();
    if (values != null) {
        for (LookUpValueEntity value : values) {
            Set<LookUpValueLocaleEntity> localeValues = value.getLookUpValueLocales();
            value.getLookUpName();
            if (localeValues != null) {
                for (LookUpValueLocaleEntity locale : localeValues) {
                    locale.getLookUpValue();
                    locale.getLocaleId();
                }
            }
        }
    }
    return values;
}
Also used : LookUpValueLocaleEntity(org.mifos.application.master.business.LookUpValueLocaleEntity) LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity) Session(org.hibernate.Session)

Example 8 with LookUpValueLocaleEntity

use of org.mifos.application.master.business.LookUpValueLocaleEntity in project head by mifos.

the class LegacyRolesPermissionsDao method changeActivityMessage.

public void changeActivityMessage(short activityId, short localeId, String newMessage) throws PersistenceException {
    ActivityEntity activityEntity = getPersistentObject(ActivityEntity.class, Short.valueOf(activityId));
    Integer lookUpId = activityEntity.getActivityNameLookupValues().getLookUpId();
    LookUpValueLocaleEntity lookUpValueLocaleEntity = legacyMasterDao.retrieveOneLookUpValueLocaleEntity(localeId, lookUpId);
    lookUpValueLocaleEntity.setLookUpValue(newMessage);
    createOrUpdate(lookUpValueLocaleEntity);
}
Also used : ActivityEntity(org.mifos.security.rolesandpermission.business.ActivityEntity) LookUpValueLocaleEntity(org.mifos.application.master.business.LookUpValueLocaleEntity)

Example 9 with LookUpValueLocaleEntity

use of org.mifos.application.master.business.LookUpValueLocaleEntity in project head by mifos.

the class LegacyRolesPermissionsDao method insertLookUpValueLocale.

private void insertLookUpValueLocale(int lookUpId, String lookUpDescription) throws PersistenceException {
    LookUpValueLocaleEntity lookUpValueLocaleEntity = new LookUpValueLocaleEntity();
    lookUpValueLocaleEntity.setLookUpId(new Integer(lookUpId));
    lookUpValueLocaleEntity.setLocaleId(Localization.ENGLISH_LOCALE_ID);
    lookUpValueLocaleEntity.setLookUpValue(lookUpDescription);
    createOrUpdate(lookUpValueLocaleEntity);
}
Also used : LookUpValueLocaleEntity(org.mifos.application.master.business.LookUpValueLocaleEntity)

Aggregations

LookUpValueLocaleEntity (org.mifos.application.master.business.LookUpValueLocaleEntity)9 LookUpValueEntity (org.mifos.application.master.business.LookUpValueEntity)4 Test (org.junit.Test)3 MessageLookup (org.mifos.application.master.MessageLookup)2 LookUpEntity (org.mifos.application.master.business.LookUpEntity)2 ActivityEntity (org.mifos.security.rolesandpermission.business.ActivityEntity)2 Session (org.hibernate.Session)1 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)1 MasterDataEntity (org.mifos.application.master.business.MasterDataEntity)1 ConfigurationException (org.mifos.config.exceptions.ConfigurationException)1 PersistenceException (org.mifos.framework.exceptions.PersistenceException)1