sling

Sling initial content loading - how to set access permissions?

南楼画角 提交于 2019-12-02 00:19:51
I have a bundle that was generated by the Maven sling-initial-content archetype, that means the content is imported into the repository when the bundle gets installed. I want anonymous users to be able to add child nodes to a specific node and I want to set these permissions automatically on bundle installation. I tried the following (stored as a JSON file in the content directory), but it generates an error: "Cannot load initial content for bundle com.example.acltest : Unable to perform operation. Node is protected." { "jcr:primaryType": "nt:unstructured", "jcr:mixinTypes": ["rep

Why we extends WCMUsePojo class while working with AEM?

谁说我不能喝 提交于 2019-12-01 08:41:52
Why we extends WCMUsepojo abstract class in our program while working with AEM? What is the advantage of using this class? Because in AEM’s component development mechanism, you likely need a way to provide back-end logic to components. That's because Sightly (when used as a rendering script language instead of the JSP pages) is on purpose a limited template language that allows to do only small basic operations, and the heavy lifting logic should be done inside a Java class or a server-side JS (that you refer using the data-sly-use element inside the Sightly script). This provide better

How to create a system user (rep:SystemUser) in AEM 6.1?

徘徊边缘 提交于 2019-12-01 08:09:11
On AEM 6.1.. I am trying to create a System User (rep:SystemUser). Can anyone help me? I need this system-user to map to a service in OSGI that i want to use to Write some data to aem content. I can see the "system users" in CRX at this location: /home/users/system I tried to create a new node to create a new-user with "jcr:primaryType rep:SystemUser", and defined the rep:PrincipalName, but that property is not being set as "Protected=true", by default is is taking as "Protected = false" and so saving the node is failing with that message. Reference: http://aemfaq.blogspot.com/2015/01/aem6

How to create a system user (rep:SystemUser) in AEM 6.1?

别等时光非礼了梦想. 提交于 2019-12-01 06:54:48
问题 On AEM 6.1.. I am trying to create a System User (rep:SystemUser). Can anyone help me? I need this system-user to map to a service in OSGI that i want to use to Write some data to aem content. I can see the "system users" in CRX at this location: /home/users/system I tried to create a new node to create a new-user with "jcr:primaryType rep:SystemUser", and defined the rep:PrincipalName, but that property is not being set as "Protected=true", by default is is taking as "Protected = false" and

How to work with a bundle in eclipse when it was downloaded from AEM

耗尽温柔 提交于 2019-12-01 06:25:24
I downloaded a zip from a running instance of AEM from package manager - http://localhost:4502/crx/packmgr/index.jsp . The zip file, when extracted contains, jcr_root and META-INF . I would like to build some functionality on top of this zip file. So I'm wondering if there is a way to work with this file in eclipse? However, there are no pom.xml files in this zip folder. So I can't just import it in Eclipse. I have AEM developer tools downloaded for Eclipse. Is there a guide available that explains how to do this? The zip file contains some Java files and I would like to make changes to those

How to work with a bundle in eclipse when it was downloaded from AEM

隐身守侯 提交于 2019-12-01 05:23:49
问题 I downloaded a zip from a running instance of AEM from package manager - http://localhost:4502/crx/packmgr/index.jsp . The zip file, when extracted contains, jcr_root and META-INF . I would like to build some functionality on top of this zip file. So I'm wondering if there is a way to work with this file in eclipse? However, there are no pom.xml files in this zip folder. So I can't just import it in Eclipse. I have AEM developer tools downloaded for Eclipse. Is there a guide available that

Which config is applied when number of matched run modes is the same

别等时光非礼了梦想. 提交于 2019-12-01 01:59:11
问题 I am using OSGI config files to define configuration for different environments, as specified in OSGI Configuration. I have configurations for multiple run modes saved in the same repository. The documentation states "If multiple configurations for the same PID are applicable, the configuration with the highest number of matching run modes is applied." What is the mechanism if multiple configurations for the same PID are applicable and two or more configurations are tied for the highest

Set a CQ5 component to editable or not editable

跟風遠走 提交于 2019-11-30 18:24:40
问题 Is it posible if i want to set a cq5 component editable in page A, but not editable in page B. For example: at page A, i have C component we allow authors to open dialog and edit the component. But we do not allow authors to open dialog to edit component C on Page B. I try to research cq:EditConfig link, but It's not enough documentation to resolve my issue. 回答1: You can set ComponentContext.BYPASS_COMPONENT_HANDLING_ON_INCLUDE_ATTRIBUTE before the include, and remove it after the include.

Sling resource vs nodes

淺唱寂寞╮ 提交于 2019-11-30 18:00:50
问题 I'm having trouble understanding why you would use resources instead of nodes in sling. So say I have something simple accessing nodes like below: NodeIterator headerNode = currentNode.getNodes(); //loop through and do something with the nodes. How would you work in resources instead of nodes. I've heard you should generally work in resources in sling not nodes. But why? I really don't understand what the benefit to this would be. I think I'm having trouble grasping what resources are as well

How to set a resource property

霸气de小男生 提交于 2019-11-30 17:49:50
I have a Sling Resource object. What is the best way to set or update its property? Tomek Rękawek It depends on the Sling version: Sling >= 2.3.0 (since CQ 5.6) Adapt your resource to ModifiableValueMap , use its put method and commit the resource resolver: ModifiableValueMap map = resource.adaptTo(ModifiableValueMap.class); map.put("property", "value"); resource.getResourceResolver().commit(); Sling < 2.3.0 (CQ 5.5 and earlier) Adapt your resource to PersistableValueMap , use its put and save methods: PersistableValueMap map = resource.adaptTo(PersistableValueMap.class); map.put("property",