instead_of_add_message

Обсуждаем TrackStudio по-русски

instead_of_add_message

Postby vsablin » Fri Apr 06, 2018 3:18 pm

Всем привет!
Появилась необходимость написать тригер при выполнении операции. По значению доп. поля нужно будет выполнять определенные действия. Для начала решил распечатать значение доп. поля. Печать есть и после нажатия на кнопку "Сохранить" идет Exception.

Тригер
public class RequestBusinessAnalysInsteadOf implements OperationTrigger{

/**
*
* @param message
* @return
* @throws GranException
*/
@Override
public SecuredMessageTriggerBean execute(SecuredMessageTriggerBean message ) throws GranException {

//SecuredTaskBean task = message.getTask();
String value = message.getUdfValue("Тип заявки");
System.out.printf("********************* Значение тиипа заявки \"%s\"\n", value);
return message;
}

}


********************* Значение тиипа заявки "Доработка в рамках сопровождения"
2018-04-06 15:14:28,195 ERROR org.apache.struts.actions.DispatchAction:execute:96 - Error
org.hibernate.QueryException: Expected positional parameter count: 1, actual parameters: [] [select new com.trackstudio.kernel.cache.MessageCacheItem(message.id, message.description, message.time, message.hrs, message.deadline, message.budget, message.task.id, message.submitter.id, message.resolution.id, message.priority.id, message.handler.id, message.handler.user.id, message.handler.prstatus.id, message.mstatus.id, message.longtext.id) from com.trackstudio.model.Message as message where message.id=?]
at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:367)
at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:323)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:98)
at com.trackstudio.tools.HibernateUtil.getList(HibernateUtil.java:42)
at com.trackstudio.tools.HibernateUtil.getList(HibernateUtil.java:53)
at com.trackstudio.kernel.cache.TaskRelatedManager.findMessage(TaskRelatedManager.java:1713)
at com.trackstudio.secured.SecuredMessageBean.<init>(SecuredMessageBean.java:54)
at com.trackstudio.app.TriggerManager.createMessage(TriggerManager.java:111)
at com.trackstudio.action.task.MessageCreateAction.saveMessage(MessageCreateAction.java:419)
at com.trackstudio.action.task.MessageCreateAction.save(MessageCreateAction.java:360)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
at com.trackstudio.action.TSDispatchAction.execute(TSDispatchAction.java:75)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at com.trackstudio.action.TSStrutsServlet.doGet(TSStrutsServlet.java:36)
at com.trackstudio.action.TSStrutsServlet.doPost(TSStrutsServlet.java:44)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
vsablin
 
Posts: 39
Joined: Fri Feb 01, 2008 12:54 pm

Re: instead_of_add_message

Postby dpochtarev » Wed Apr 11, 2018 2:02 pm

Проверяем пока.
dpochtarev
 
Posts: 281
Joined: Wed Aug 22, 2012 4:35 pm

Re: instead_of_add_message

Postby vsablin » Thu Apr 12, 2018 1:32 pm

После нескольких экспериментов выяснилось, что если возвращать новый messageBean, например так

SecuredMessageTriggerBean msg = message.create(false);

return msg;

то все работает корректно.
vsablin
 
Posts: 39
Joined: Fri Feb 01, 2008 12:54 pm


Return to TrackStudio Support [Russian]

Who is online

Users browsing this forum: Google [Bot] and 8 guests

cron