How to choose AEM component for dialog and component creation - aem

I am new to AEM (6.5),
I found different components in different locations, each component is used in component creation and dialog creation. I am confused, which component is suitable for which purpose?
ie. for dialog creation and custom component creation and extending components.
Please tell me the bellow components purpose or differents or when to use it.
1 . /libs/granite/ui/components/coral/foundation
2. /libs/granite/ui/components/foundation
3. /libs/foundation/components
4. /libs/wcm/foundation/components
5. /libs/cq/gui/components/authoring
6. /apps/core/wcm/components

[1] - Overlay Component: component by copying a foundation component to your project and extending based on requirement.
/libs/foundation/components --copy to--- > /apps//components
[2] - Override Component : creating component nodes and setting value of sling:resourceSuperType property as "/libs/foundation/components/"
[3] - Proxy pattern component from core component: Override component from /apps/core/wcm/components to your aem app /apps/your-app/components
in these all three [3] Proxy pattern one is better approach when you are planning to implementation with latest terminology and also [1] and [2] is not recommended since whenever planning of upgrade in AEM therefore best approach is [3]rd, since it will be helping to make project upgrade free and multiple version of core component also give you advantage over.

Related

how to export then import a powerapps solution that has a canvas app using a custom component

I cannot seem to export then import a powerapps solution that has a canvas app that references a custom component. I'm using the powerapps portal to create the solution, where I add the canvas app that uses the custom component. When I export, download, and try to import the solution at this point it fails with the error:
error code 8004F036: The dependent component CustomControl (Id=xxx) does not exist. Failure trying to associate it with CanvasApp (Id=yyy) as a dependency. Missing dependency lookup type = EntityNameLookup.
If I first go to the solution and click 'add required objects' it will not add the custom component. If I manually add it, it shows it as added, but still after exporting, downloading, and importing, I get the same error. It would be great if someone knows the proper steps to get this working.
You will have to do this in 2 steps.
custom control (either you created on or you used from some 3 rd party) should be deployed (imported) to Target system. If it is managed solution from 3rd party then you might have solution.zip file use this and deploy to target system. If you created this custom control, then create separate solution and just add your custom control and deploy this solution.
Once custom control is imported, then deploy/import your powerapps solutions.

AEM 6.3 Classic UI issue in overlay functionality error "TypeError: CQ.security.data is undefined"

In AEM 6.3 classic UI, When i am trying to overlay
/libs/cq/security/widgets/source/widgets/security/data/AclStore.js
to
/apps/cq/security/widgets/source/widgets/security/data/AclStore.js
the following error is coming
TypeError: CQ.security.data is undefined CQ.security.data.UserAclStore
= CQ.Ext.extend(CQ.security.data.AclStore,{
Like this we are getting error for all the overlay js has issue in AEM 6.3
Correct me if I'm wrong but I don't believe the Sling Resource Resolution kicks in when resolving the contents of client libraries.
To extend the OOTB functionality, you need to:
create your own client library with a dependency to the original
be part of the appropriate category
override the functions/objects as you desire
More info: https://docs.adobe.com/docs/en/aem/6-2/develop/extending/customizing-page-authoring-touch.html
The Sling Resource Merger itself seems to be only applicable to Touch UI and I've only ever used it when making changes to the authoring UI (i.e. navigation menus)
The Sling Resource Merger and related methods can only be used with Granite. This also means that it is only appropriate for the touch-optimized UI; in particular overrides defined in this manner are only applicable for the touch-optimized dialog of a component.
source: https://docs.adobe.com/docs/en/aem/6-2/develop/platform/sling-resource-merger.html
I have resolved the issue using the below logic. Clientlibs js file creation logic is differed in AEM 6.3.
In AEM 6.1 Clientlibs js creation is binding the overlaid files from /apps/cq/security/widgets/source/widgets/js.txt and non overlaid files from /libs/cq/security/widgets/source/widgets/js.txt
In AEM 6.3 Clientlibs js creation is binding files from /apps/cq/security/widgets/source/widgets/js.txt only.
Because of this non overlaid files (CQ.security.js) are not binding into clientlibs js(widgets.js) and its gives the below error
TypeError: CQ.security.data is undefined CQ.security.data.UserAclStore
= CQ.Ext.extend(CQ.security.data.AclStore,{
So i have merged the js.txt of
/libs/cq/security/widgets/source/widgets/js.txt into
/apps/cq/security/widgets/source/widgets/js.txt and it's resolved the
issue.
Please provide your answer if there is any other way to resolve this issue.

UI5 Component Metadata

I'm looking for a document with the possible metadata property names and config parameters for a component.
There are many documents on the internet with such definition. The question is how I know if the name of a property/parameter setting is a valid name.
metadata : {
name : "XXXXX",
version : "1.0",
includes : [],
dependencies : {
libs : ["sap.m", "sap.ui.layout"],
components : []
},
rootView : "XXXXX",
config : {
resourceName : "i18n",
resourceBundle : "XXXX",
serviceConfig : {
name : "main",
serviceUrl : "XXXXX",
}
}
There is a document available here which describes all possible metadata. Since there is no real assistance during design-time, you have to have a look in the API to check the possible values. If you want to extend it with your own properties/parameters, just make sure that the name is not too generic since the Component can be extended with each new version of UI5.
The approach of defining component metadata in the component itself has been superseded by an approach using a manifest file. You will find all available properties in the documentation .
The Component class extends the ManagedObject class and provides specific metadata for components. The UIComponent class provides additional metadata for the configuration of user interfaces or the navigation between views.
The metadata defined in component.js is common for faceless components and UI components. The following parameters are available:
abstract: Specifies if your component class is an abstract class that serves as a base for other components
version: Version of your component; this parameter belongs to the design-time metadata and is currently not used; it may be used in the future in the design-time repository
includes: Array of strings containing the paths to CSS and JavaScript resources for your component; will be added to the header of the HTML page and loaded by the browser. The resources will be resolved relative to the location of Component.js.
dependencies: Used to specify all external dependencies, such as libraries or components. Like the includes for resources that are added to the application’s HTML, the dependencies are loaded by SAPUI5 core before the component is initialized. Everything that is referenced here can be used in your component code right from the start. Specify here external dependences such as libraries or components, that will be loaded by SAPUI5 core in the initialization phase of your Component and can be used after it.
libs: Path to the libraries that should be loaded by SAPUI5 core to be used in your component
components: Full path to the components that should be loaded by SAPUI5 core to be used in your component
ui5version: Minimum version of SAP UI5 that the component requires; it helps to be ensure that the features of SAPUI5 runtime used in this component are available. As SAPUI5 currently does not enforce the use of the correct version, it is only used for information purposes.
properties: Defined for components in the same way as for a control or view
library: Specify the library the component belongs to
config: Static configuration; specify the name-value pairs that you need in the component
customizing: Customizing for components and views, see Extending SAPUI5 Applications
sap.ui.viewExtensions: Used for providing custom view content in a specified extension point in the standard application
sap.ui.viewModifications: Used for overriding control properties in the standard application
sap.ui.viewReplacements: Used for replacing a standard view with a custom view
sap.ui.controllerExtensions: Used for replacing a standard controller with a custom controller
for more Information go to the url:
https://sapui5.netweaver.ondemand.com/sdk/#docs/guide/0187ea5e2eff4166b0453b9dcc8fc64f.html
Well, from the code you could check if the property exist with the get(Property Name) method that all elementes have.
Otherwise all the properties ad hoc are in this url that Tim Gerlach shared for you before.
If it is a regular development approach, you should ideally look at the API of the component class.
If you are using metadata driven approach for development and you might generate the required code then you should fetch details from metadata information provided by the class or read it from .js file. ".js" will be helpful if you are not using SAPUI5 runtime.
Hope, this helps.
.........
Good Luck
Final answer has to be by looking through the source code as nothing else, even the API documentation, will be able to be 100% accurate against the consuming source.
As mentioned in the documentation, the definition of Component's metadata has largely moved to a separate file named manifest.json (aka. Application Descriptor).
With the introduction of the descriptor for applications, components, and libraries, we recommend to migrate the component metadata to the descriptor. [...] For more information, see Descriptor for Applications, Components, and Libraries.
Besides just looking at the list of available parameters in the doc, the closest "assistance" you could get is the Descriptor Editor from Web IDE.
The Descriptor Editor provides available choices, placeholder suggestions, and input validation.

Joomla! 2.5+: Abuse a system plugin to create an URI addressable view

As it is fairly simple to create frontend views into the content area using Joomla!'s component infrastructure and a menu item, I wonder if it is not possible to abuse a system plugin to achive the same goal. Reason: keep the code slim (A plugin can consist only of two files.)
Suppose having mydomain.com/myuri, the system plugin should catch myuri, than override the content by a special content using onAfterRender.
My approach is to set some class variable within the derived plugin class to true, if the URI was hit. How can this be done, and which onEvent should be used?

IoC, MVC4 Web API & HttpParameterBinding/ParameterBindingAttribute

I'm using ASP.Net MVC 4 RTM Web API. I have a controller action with a parameter that I'd like to populate via custom model binding. To achieve this, I created a class that derives from System.Web.Http.Controllers.HttpParameterBinding that sets the value of this parameter. I then created an attribute class that derives from System.Web.Http.ParameterBindingAttribute which I use to decorate the parameter on my controller action.
This is all working great, my HttpParameterBinding class is populating the action parameter correctly. The problem I have is that my custom parameter binding class has a dependency that I'd like resolved via my IoC container (Unity). Is there a way to override how Web API creates HttpParameterBinding instances so that I can build up my custom binding class dependency from Unity? I was able to do something similar for a filter attribute by creating a custom filter provider that uses Unity's BuildUp method to populate dependencies, however I'm not seeing anything similar for Web API's HttpParameterBindings.
In general: to use IoC / Unity in the Web API you need to set it up seperately.
Try downloading the nuget package Unity.WebApi and see if that helps!
Take a look at this article: Parameter Binding in WebAPI
It walks through a couple different options from Converters to Binders to BinderProviders. It sounds like you may be able to write a custom ModelBinderProvider which knows how to provide your dependency. If that isn't high enough in the chain you can look at replacing the default IActionValueBinder service. It's a DefaultActionValueBinder instance, which you can extend or simply re-implement.
I also highly recommend downloading the WebAPI source code, as it's been an incredible help for these issues as I've run into them. Here's the WebAPI source code. I recommend downloading it so you can open it in VS for easy navigation.
Feel free to check out FlitBit too (It's very modular, don't let the number of packages scare you off)! I'm working on a WebAPI package for supporting FlitBit, specifically FlitBit.IoC and FlitBit.Dto. I'll add an update if I work out my IoC issue, since it's very similar to yours.