The VehicleService.Java WCMUse class below, build and deploy it using maven to your AEM.
package com.aem;
import org.apache.sling.api.SlingHttpServletRequest;
import com.day.cq.wcm.api.Page;
import java.util.HashMap;
import java.util.Map;
import com.adobe.cq.sightly.WCMUse;
public class VehicleService extends WCMUse {
private Map<String, String> map;
@Override
public void activate() throws Exception {
SlingHttpServletRequest request = getRequest();
Page currentPage = getCurrentPage();
createVehicleDetails(request, currentPage);
}
/**
* This will Create vehicle map
*
* @return
*/
private void createVehicleDetails(SlingHttpServletRequest request, Page currentPage) {
map = new HashMap<String, String>();
map.put("name", "NewVehicle");
map.put("price", "1000");
}
/**
* This will return vehicle
*
* @return vehicle map
*/
public Map<String,String> getVehicleDetails() {
return map;
}
}
--------------Similar Posts:----------
package com.aem;
import org.apache.sling.api.SlingHttpServletRequest;
import com.day.cq.wcm.api.Page;
import java.util.HashMap;
import java.util.Map;
import com.adobe.cq.sightly.WCMUse;
public class VehicleService extends WCMUse {
private Map<String, String> map;
@Override
public void activate() throws Exception {
SlingHttpServletRequest request = getRequest();
Page currentPage = getCurrentPage();
createVehicleDetails(request, currentPage);
}
/**
* This will Create vehicle map
*
* @return
*/
private void createVehicleDetails(SlingHttpServletRequest request, Page currentPage) {
map = new HashMap<String, String>();
map.put("name", "NewVehicle");
map.put("price", "1000");
}
/**
* This will return vehicle
*
* @return vehicle map
*/
public Map<String,String> getVehicleDetails() {
return map;
}
}
--------------Similar Posts:----------
-------------------------------------------
No comments:
Post a Comment