Adempiere workflow process throw llegalStateException - adempiere

I implemented a workflow and workflow process for a custom table in adempiere 3.80.
But when I click on the docaction button a popup will appear and when I click on its OK button, a message box appeared as terminated.
In eclipse, the console shows an exception
java.lang.IllegalStateException: Persistent Object not DocAction.

Check that your custom table has the model classes generated and that your MCustomTable class implements the DocAction interface.
Here is the MOrder model
public class MOrder extends X_C_Order implements DocAction
{
....

Related

Unable to register VM through Prism Navigation

I'm creating WPF Core 3.1 app using Prism 7. In one of the view I am trying to register the view model for PRISM navigation through:
containerRegistry.RegisterForNavigation<ViewA, ViewAViewModel>();
And when required I do request to PRISM navigation service to navigate to the view using Region Manager
_regionManager.RequestNavigate(RegionNames.ContentRegion, "ViewA");
Navigation to the view is completed and I'm able to see the view on the defined region but the view model is not assigned to the view.
I tried to manually register the view model using the ViewModelLocationProvider but still the view model is not assigned.
ViewModelLocationProvider.Register<ViewA, ViewAViewModel>();
But if I use the PRISM Autowire property in the view then the view model is discovered and assigned to the view.
prism:ViewModelLocator.AutoWireViewModel="True"
View model class declared using IConfirmNavigationRequest interface required for navigation request handling
public class ViewAViewModel : RegionViewModelBase , IConfirmNavigationRequest
I am unable to figureout what I'm missing here.
The only thing I see wrong is that you would need to use the interface INavigationAware, not IConfirmNavigationRequest. I assume RegionViewModelBase implements BindableBase already.
public class ViewAViewModel : RegionViewModelBase, INavigationAware

Displaying entity level error messages in thymeleaf

I have written a custom annotation and placed the annotation on the entity level.
#ValidConfirmPassword
public class User {...}
The custom validator is returning the invalid message, but, I am not able to display the message on the UI.
How should I display the error messsage specific to the entity using Thymeleaf?

Valid ways to interrupt an OSGi component from being activated

I have an OSGi component:
#Component(immediate=true)
public class SomeComponent implements SomeInterface {...}
Note that the component is immediate. Also, since the component class is implementing an interface, I understand that a service will be registered automatically upon (as part of the) activation of the component.
Now, I would like to do be able to dynamically interrupt the component activation and service registration if certain conditions are met. Throwing a 'ComponentException' in a component activator doesn't seem to do the job:
#Activate
public void activate() {
if (notReady)
throw new ComponentException("Component not ready");
}
Any suggestions? Thanks!
You cannot preempt the service registration which happens before activation. You would be better off with two components. One which is immediate with no service which decides whether to enable or disable the second component which has the service. This second component can be disabled by default.

Overriding Liferay Startup Events

I have a question with respect to Liferay Startup Events.
In Liferay documentation it is given:
Startup Events
Input a list of comma delimited class names that extend com.liferay.portal.struts.SimpleAction. These classes will run at the specified event.
Could anybody please tell me what is the difference between global.startup.events and application.startup.events and could any body tell me in what case do we need to override them?
And should both these start up events extend com.liferay.portal.struts.SimpleAction?? and I couldn't find anything inside the SimpleAction except this:
public abstract class SimpleAction {
public abstract void run(String[] ids) throws ActionException;
}
}
I also wanted to know this class contains nothing, how does Liferay knows what XML files to read and process?
Thanks
global.startup.events - run once for global server
application.startup.events - run for every portal instance at startup. If you have one portal instance at your server (normal case) - here is no difference between this properties. I use application.startup.events.
Extend the com.liferay.portal.kernel.events.SimpleAction class and impliment run-methode, that will call by liferay startup. For this purpose create a hook plugin and register in liferay-hook.xml the property file, e.g.:
<hook>
<portal-properties>portal-myext.properties</portal-properties>
</hook>
Create portal-myext.properties in classpath and set your startup action:
application.startup.events=com.my.actions.MyStartupAction
The action MyStartupAction must be in the same classpath, hence same hook-plugin.

bitronix transaction manager

I'm trying to migrate from JPA to JTA and use bitronix transaction manager. I'm getting below error message when try to run unit tests. According to bitronix documentation this is normal b/c my spring context configuration is trying to load the resources twice (once in base class and then in the test class, see code below), I have tried the same with atomikos and I got similar result.
Caused by:
java.lang.IllegalArgumentException:
resource with uniqueName 'xyzDb'
has already been registered
My base class
#ContextConfiguration(locations = {"classpath:com/xyz/baseContext.xml"})
#Transactional
public abstract class AbstractTestSupport extends Assert implements ApplicationContextAware
{
In some unit tests I have to extend the test support and add a context config file like below. so it loads context once for base class and another time for child class and fails
Child class
#ContextConfiguration(locations = {"classpath:com/xyz/testContext.xml"})
public class UnitTest extends AbstractTestSupport
{
After the test I'm shutting down context, so next test works fine as long as it doesn't extend the base class with another context config file.
#AfterClass
public static void onTearDownAfterClass() throws Exception
{
applicationContext.shutdownApplicationContext();
assertFalse("Spring application context is still active after shutdown. ", applicationContext.isActive());
}
I want to keep context config files in the child classes and make this work like that, any ideas greatly appreciated....
The error message basically means you created the connection pool with unique name 'xyzDb' (remember there is a uniqueName property you need to set on BTM's pools?) for the second time at the time the exception is thrown. You cannot do that: each connection pool must have a unique name and must be closed before another one with an identical name can be created.
I suppose there is some overlap between your two context files causing this or maybe the connections pools aren't always closed like they should. Unfortunately you published too little information to get a definitive answer.

Resources