This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here is how you can use configuration factory, | |
public interface MyCustomService{ | |
} | |
-------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package wemblog.configfactory.test | |
@Component(configurationFactory = true, metatype = true) | |
@Service(value = MyCustomService.class) | |
public Class WemBlogFactory implements WemBlogService{ | |
@Property(label="Test Property",name="test", description="This is test property example", value="test") | |
private String test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Initialize a variable | |
<sly data-sly-test.pagePath="${currentPage.path}"/> | |
<sly data-sly-test.someString='test'/> | |
<sly data-sly-use.SomeOtherObject="${'TopNavHelperUse' @ test='test'}"> | |
<sly class="sightly-topnav" data-sly-use.topnav="${'Topnav' @ pageNumber='5', someString=someString, pageObject=currentPage, helperString=SomeOtherObject.test}"/> | |
${topnav.totalPage} ${topnav.someOtherString} ${topnav.pagePath} ${topnav.helperTest} | |
#Here is Output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package wemblog.sightly.use | |
@Model(adaptables = SlingHttpServletRequest.class) | |
public class ExternalUrl { | |
@Inject | |
private Externalizer externalizer; | |
@Inject // Using the bindings from Sightly (${currentPage.path} | |
protected Page currentPage; | |
@Inject @Optional // parameter from data-sly-use |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.test; | |
import java.util.HashMap; | |
import java.util.Map; | |
import com.adobe.cq.sightly.WCMUse; | |
public class WcmUseSample extends WCMUse { | |
private Map<String, String> myHashMap; | |
public void activate() throws Exception { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ackage com.project.sightly; | |
import com.adobe.cq.sightly.WCMUse; | |
import org.apache.sling.commons.json.JSONObject; | |
import java.util.*; | |
public class JsonHelper extends WCMUse { | |
private String[] json; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#In your Java Class | |
#this assumes that there is a multi string property tabs | |
package com.wemblog.use; | |
public class WemBlogUse extends WCMUse { | |
/** | |
* CASE 1: Just access a multi value property and iterate over them | |
*/ | |
public Iterator<Map<String, Object>> getTabTitles(){ | |
List<Map<String, Object>> infos = new LinkedList<Map<String,Object>>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Fixed Array | |
<ul data-sly-list="${ [1,2,3,4] }"> | |
<li>${item}</li> | |
</ul> | |
#List page children | |
<ul data-sly-list.child="${currentPage.listChildren}"> | |
<li>${child.title}</li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head data-sly-use.clientLib="${'/libs/granite/sightly/templates/clientlib.html'}"> | |
<!--/* for css+js */--> | |
<meta data-sly-call="${clientLib.all @ categories='your.clientlib'}" data-sly-unwrap></meta> | |
<!--/* only js */--> | |
<meta data-sly-call="${clientLib.js @ categories='your.clientlib'}" data-sly-unwrap></meta> | |
<!--/* only css */--> | |
<meta data-sly-call="${clientLib.css @ categories='your.clientlib'}" data-sly-unwrap></meta> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wemblog.utility; | |
import java.util.List; | |
import org.apache.sling.api.resource.ResourceResolver; | |
import com.day.cq.replication.Agent; | |
import com.day.cq.replication.ReplicationActionType; | |
/** | |
* Replication Utility Method for some common replication task |