use of com.axelor.meta.CallMethod in project axelor-open-suite by axelor.
the class AccountManagementServiceAccountImpl method getProductAccount.
/**
* Get the product tax
*
* @param product
* @param company
* @param isPurchase
* @param fixedAsset Specify if we should get the purchase account for fixed asset or not. Used
* only if isPurchase param is true.
* @param configObject Specify if we want get the tax from the product or its product family
* <li>1 : product
* <li>2 : product family
* @return
* @throws AxelorException
*/
@CallMethod
protected Account getProductAccount(Product product, Company company, boolean isPurchase, boolean fixedAsset, int configObject) {
AccountManagement accountManagement = this.getAccountManagement(product, company, configObject);
Account account = null;
if (accountManagement != null) {
if (isPurchase) {
if (fixedAsset) {
account = accountManagement.getPurchFixedAssetsAccount();
} else {
account = accountManagement.getPurchaseAccount();
}
} else {
account = accountManagement.getSaleAccount();
}
}
if (account == null && configObject == CONFIG_OBJECT_PRODUCT) {
return getProductAccount(product, company, isPurchase, fixedAsset, CONFIG_OBJECT_PRODUCT_FAMILY);
}
return account;
}
use of com.axelor.meta.CallMethod in project axelor-open-suite by axelor.
the class AppBaseServiceImpl method getCustomStyle.
@CallMethod
@Override
public String getCustomStyle() {
AppBase appBase = Beans.get(AppBaseRepository.class).all().fetchOne();
String style = appBase.getCustomAppStyle();
if (StringUtils.isBlank(style)) {
return null;
}
return style;
}
use of com.axelor.meta.CallMethod in project axelor-open-suite by axelor.
the class ActionEmailBuilderService method sendEmail.
@CallMethod
public ActionResponse sendEmail(Long objectId, String model, String tag, Long templateId, int sendOption) throws ClassNotFoundException, InstantiationException, IllegalAccessException, AxelorException, IOException, MessagingException {
Template template = templateRepo.find(templateId);
Message message = templateMessageService.generateMessage(objectId, model, tag, template);
ActionResponse response = new ActionResponse();
if (sendOption == 0) {
messageService.sendByEmail(message);
} else {
response.setView(ActionView.define(I18n.get(IExceptionMessage.MESSAGE_3)).model(Message.class.getName()).add("form", "message-form").param("forceEdit", "true").context("_showRecord", message.getId().toString()).map());
}
return response;
}
use of com.axelor.meta.CallMethod in project axelor-open-suite by axelor.
the class WkfDisplayServiceImpl method getWkfNodeCountUrl.
@Override
@CallMethod
public String getWkfNodeCountUrl(WkfModel wkfModel) {
try {
Map<String, Integer> activityCountMap = new HashMap<>();
List<WkfInstance> instances = Beans.get(WkfInstanceRepository.class).all().filter("self.wkfProcess.wkfModel.id = ?1", wkfModel.getId()).fetch();
log.trace("Total process instances: {}", instances.size());
for (WkfInstance instance : instances) {
getActivityPassCount(instance.getInstanceId(), activityCountMap);
}
log.trace("Count map: {}", activityCountMap);
String activityCount = activityCountMap.keySet().stream().map(it -> it + ":" + activityCountMap.get(it)).collect(Collectors.joining(","));
String url = String.format(engineService.getWkfViewerUrl(), "id=" + wkfModel.getId(), null, activityCount);
log.trace("Url created: {}", url);
return url;
} catch (Exception e) {
}
return null;
}
use of com.axelor.meta.CallMethod in project axelor-open-suite by axelor.
the class WkfInstanceServiceImpl method findProcessInstanceByNode.
@Override
@CallMethod
public List<String> findProcessInstanceByNode(String nodeKey, String processId, String type, boolean permanent) {
HistoricProcessInstanceQuery processInstanceQuery = engineService.getEngine().getHistoryService().createHistoricProcessInstanceQuery();
List<String> processInstanceIds = processInstanceQuery.processDefinitionId(processId).activeActivityIdIn(nodeKey).unfinished().list().stream().map(it -> it.getId()).collect(Collectors.toList());
if (permanent) {
processInstanceQuery = engineService.getEngine().getHistoryService().createHistoricProcessInstanceQuery();
processInstanceQuery.processDefinitionId(processId).executedActivityIdIn(nodeKey).list().stream().forEach(it -> processInstanceIds.add(it.getId()));
}
if (type != null && type.equals(BpmnModelConstants.BPMN_ELEMENT_END_EVENT)) {
engineService.getEngine().getHistoryService().createHistoricProcessInstanceQuery().executedActivityIdIn(nodeKey).completed().or().finished().endOr().processDefinitionKey(processId.substring(0, processId.indexOf(":"))).list().forEach(it -> processInstanceIds.add(it.getId()));
}
processInstanceIds.add("0");
return processInstanceIds;
}
Aggregations