use of org.mifos.application.accounting.business.ProcessUpdateBo in project head by mifos.
the class AccountingDaoHibernate method findLastProcessingUpdatedDate.
@Override
public String findLastProcessingUpdatedDate(String namedQueryString, String globalOfficeNumber) {
String lastProcessingDate = null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
Query query = createdNamedQuery(namedQueryString);
query.setString("GLOBAL_OFFICE_NUMBER", globalOfficeNumber);
List<ProcessUpdateBo> list = query.list();
if (list.size() == 0) {
Query q = createdNamedQuery("getConfigurationKeyValueByKey");
q.setString("KEY", "MisProcessing");
List<ConfigurationKeyValue> value = q.list();
if (value.size() > 0) {
ConfigurationKeyValue configurationKeyValue = value.get(0);
lastProcessingDate = configurationKeyValue.getValue();
}
} else if (list.size() > 0 && !"".equals(list.get(0).getLastUpdateDate())) {
ProcessUpdateBo processUpdateBo = list.get(0);
if (processUpdateBo.getLastUpdateDate() != null) {
lastProcessingDate = simpleDateFormat.format(processUpdateBo.getLastUpdateDate());
}
}
return lastProcessingDate;
}
use of org.mifos.application.accounting.business.ProcessUpdateBo in project head by mifos.
the class AccountingDaoHibernate method updateLastProcessUpdatedDate.
@Override
public void updateLastProcessUpdatedDate(Date lastProcessDate, String globalOfficeNumber) {
Query q = createdNamedQuery("getLastProcessUpdateDate");
q.setString("GLOBAL_OFFICE_NUMBER", globalOfficeNumber);
List<ProcessUpdateBo> list = q.list();
if (list.size() > 0) {
ProcessUpdateBo processUpdateBo = list.get(0);
processUpdateBo.setLastUpdateDate(lastProcessDate);
try {
createOrUpdate(processUpdateBo);
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
} else {
try {
ProcessUpdateBo processUpdateBo = new ProcessUpdateBo();
processUpdateBo.setGlobalOfficeNumber(globalOfficeNumber);
processUpdateBo.setLastUpdateDate(lastProcessDate);
save(processUpdateBo);
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
}
Aggregations