I created the message.properties file inside my plugin under OSGI-INF/l10n/.
Then I created my Message.java class with the #Message(contributiURI="").
Then I injected the message in the class where I am showing the message like follows,
public class test{
#Inject
#Translation
private Messages message;
//some code
sysout(messages.Test);
//somecode
}
Also, I have added following in the MANIFEST.MF file
Bundle-Localization: OSGI-INF/l10n/messages
after doing all the above. I executed my code and I could not able to get the value from the properties file. it just returns "!test!". Could anyone please tell me what did I miss?
Thanks & Regards,
Chinniah
Related
I want to override class MySQL of PrestaShop module ps_facetedsearch that is located in file: mystore/modules/ps_facetedsearch/src/Adapter/MySQL.php
How do I achieve this?
EDIT:
Class MySQL that I want to override is defined in file mystore/modules/ps_facetedsearch/src/Adapter/MySQL.php.
This class is used by class Search of same module and is defined in file mystore/modules/ps_facetedsearch/src/Product/Search.php. Class Search is used by another module class and so on, so there is a long 'chain' of classes.
Do I need to extend all chained classes or can I somehow override only the MySQL class that really requires modification?
Override Module Classes
To modify behavior of a module’s class you have to put your modified class at
ROOT/override/modules/MODULENAME/OVERRIDECLASS.php
You have to create a PHP file on the location below and call it ps_facetedsearch.php
ROOT/override/modules/ps_facetedsearch/ps_facetedsearch.php
Inside the overriding class you can add the code below.
<?php
class Ps_FacetedsearchOverride extends Ps_Facetedsearch
{
public function getContent()
{
return "Hello store owner! this code is brought to you by crezzur.com";
}
}
?>
After saving your ps_facetedsearch.php override and clearing the Prestashop cache you will see the message "Hello store owner! this code is brought to you by crezzur.com" when you open the module ps_facetedsearch.
I created a class extending RouteBuilder but #PropertyInjector field value is null.
Maven pom.xml has camel-core dependency.
There are some posts that says they got this code working but the code is showing only the
RouteBuilder part. Is there any specific jar to be added or CamelContext.addRoutes() in a particular way to get the injection working?
If there is any github code that contains working example for Camel #PropertyInject annotation please share that link.
If I understand your question correctly something like this is what you want to achieve?
#Component
public class TestClass extends RouteBuilder {
#PropertyInject("test.name")
private String name;
#Override
public void configure() throws Exception {
from("direct:test")
.log(name);
}
}
The property test.name will be something you put in your application.properties file.
So, i'm not sure what i'm doing wrong here but for some reason the callback function in TypeScript that i have doesn't have anything but _proto in the response's .data property whenever i set private properties in C# and new up an object that is filled with constructed properties. However, if the properties are public and i don't use a constructor then i can see the response's .data property is filled like i would expect it to be. Here is an example of what works:
public class ThisWorks{
public string MyProperty{get;set;}
}
Inside application layer:
ThisWorks example = new ThisWorks();
example.MyProperty = myReflectedProperty;
return example;
However, this does not work:
public class ThisDoesNotWork{
private string MyPrivateProperty {get;set;}
public ThisDoesNotWork(string myPrivateProperty){
MyPrivateProperty = myPrivateProperty;
}
}
What's causing this to happen? My TypeScript service has not changed but for some reason the data isn't coming across from the service call...Any help would be greatly appreciated!
Is TestNG's "ITestResult" an Interface or a Class? we are using the below code to take the screenshot of the webpage whenever there is a failure. we are getting the status of the test by using ITestResult. I have checked the TestNG's API and it is showing as ITestResult as a interface, then which class is implemented this interface? And how we are accessing the method getStatus() using Interface reference? Can anyone clarify my doubt?
#AfterMethod(alwaysRun=true)
public void takeScreenShot(ITestResult result){
if(result.getStatus()==2){
ITestNGMethod instance = result.getMethod();
String testName = instance.getMethodName();
TestUtil.captureScreen("xyz", testName,"Failure_Screenshots");--> method to take screen shot and save the image file in specific directory
}
}
Thanks in Advance!!
org.testng.internal.TestResult is the class which implements the ITestResult interface.
In eclipse, you can click on a type and click Ctrl+T to see the Type Hierarchy to get this data for any type.
I am created a MainView that it's DataContext is a MainViewModel initialized in xaml.
The MainView contains a ContentControl that is bound to the Content property of the MainViewModel.
I added some content in the MainViewModel constructor, so that if the current user is not logged in, it automatucally loads LoginView (and correspondingly it's DataContext LoginViewModel) into this Content property.
Now my question is, what should I do when the user successfully logs in:
'To be called from the LoginCommand
Private Sub Login
'Do Login
If WebContext.Current.User.IsAuthenticated Then
' - Publish a global event to be subscribed and caught from the MainViewModel
' - Close LoginView
' - The MainViewModel should set it's Content property back
' to what the user initially intended to open
End If
End Sub
How is this done?
Note: I prefer using prism's EventAggregator rathen then other stuff, but I have no clue:
How to spread it out between the ViewModels
How to create events (I don't need to pass parameter, nor do I need it to be generic, just Action, LoginAction - no parameters.
How do I subscribe from the MainViewMode.
I do NOT use MEF or Unity, nor do I use seperated modules, all my application is in one single assembly.
I prefer not to write any code in the code-behind at all
Answer in both VB.NET or C# are welcommed the same
Any help would be recommended
You can go here for info regarding the EventAggregator.
You could also use the following code to create an instance of the EventAggregator without using MEF or Unity:
internal static class EventAggregatorHelper
{
private static IEventAggregator _Current = new EventAggregator();
public static IEventAggregator Current
{
get
{
return _Current;
}
}
}
And you could then call the EventAggregator like so passing in the required information to the aggregator:
EventAggregatorHelper.Current.GetEvent<SelectedItemChangedEvent>().
Subscribe(HandleSelectedItemChangedEvent);
In this case the SelectedItemChangedEvent and the subscriber that deals with this event.
The SelectedItemChangedEvent is a class declared as shown below:
public class SelectedItemChangedEvent : CompositePresentationEvent<String>
{
}
and the subscriber would be something like this:
internal void HandleSelectedItemChangedEvent(string viewName)
{
if (!String.IsNullOrEmpty(viewName))
{
//Do whatever you need to do here.
}
}
The link to the Event Aggregator I posted at the start should clear most things up for you.
Hope this helps.