on 2018 Apr 13 3:55 PM
I have created a component with navigation node as an attribute.(It has child nav nodes with link component). In CMSCockpit Editor view I need to edit link name and url of the link component.
While opening editor view of link component it is showing only link name and throwing an error which is same as raised question.
Example: Editor view [Parent nav node(Editor view) -> child nav node(Editor view) -> child nav node(Editor view) -> Link component(Editor view)[Visible only with name]]
If I add that link component to content slot then it is working fine. But I don't need to add to content slot it will be a duplicate.
Kindly suggest with answers.
Narendra, thanks for you answer,
Yes ,There is no null check in 6.7 dao, but still appand a empty contentSlots for flexibleSearch condition
public Collection<AbstractPageModel> findPagesByContentSlotsAndPageStatuses(final Collection<ContentSlotModel> contentSlots, final Collection<CatalogVersionModel> catalogVersions, final List<CmsPageStatus> pageStatuses) {
final StringBuilder queryBuilder = new StringBuilder();
final Map<String, Object> queryParameters = new HashMap<String, Object>();
queryBuilder.append("SELECT {ap.pk} ").append("FROM {AbstractPage AS ap ").append("JOIN ContentSlotForPage AS csfp ").append("ON {ap.pk}={csfp.page} ").append("JOIN CmsPageStatus as stat ").append("ON {ap.pageStatus}={stat.PK}} ").append("WHERE ");
queryBuilder.append(FlexibleSearchUtils.buildOracleCompatibleCollectionStatement("{csfp.contentSlot} in (?contentSlots)", "contentSlots", "OR", (Collection)contentSlots, (Map)queryParameters));
queryBuilder.append(" AND ");
queryBuilder.append(FlexibleSearchUtils.buildOracleCompatibleCollectionStatement("{ap.catalogVersion} in (?catalogVersions)", "catalogVersions", "OR", (Collection)catalogVersions, (Map)queryParameters));
this.appendPageStatusesToQuery(queryBuilder, pageStatuses, queryParameters, "AND");
final SearchResult<AbstractPageModel> result = (SearchResult<AbstractPageModel>)this.search(queryBuilder.toString(), (Map)queryParameters);
return (Collection<AbstractPageModel>)result.getResult();
}
but FlexibleSearchQuery will check null collection, the expception will be throw for empty collection
public void addQueryParameters(Map<String, ? extends Object> params) {
Iterator var3 = params.entrySet().iterator();
} entry = (Entry)var3.next();
ServicesUtil.validateParameterNotNull(entry.getValue(), "Value is required, null given for key: " + (String)entry.getKey());
} **while(!(entry.getValue() instanceof Collection) || !((Collection)entry.getValue()).isEmpty());
throw new IllegalArgumentException("Value is instanceof Collection but cannot be empty collection for key: " + (String)entry.getKey());**
Entry entry;
do {
if (!var3.hasNext()) {
this.queryParameters.putAll(params);
return;
}
finally, as your said, I overrided the DefaultCMSPageDao-->findPagesByContentSlots method, this issue has been fixed
/**
* CustomCMSPageDao
*/
public class CustomCMSPageDao extends DefaultCMSPageDao
{
@Override
public Collection<AbstractPageModel> findPagesByContentSlots(final Collection<ContentSlotModel> contentSlots,
final Collection<CatalogVersionModel> catalogVersions)
{
if (CollectionUtils.isEmpty(contentSlots))
{
return Collections.emptyList();
}
return this.findPagesByContentSlotsAndPageStatuses(contentSlots, catalogVersions, Arrays.asList(CmsPageStatus.ACTIVE));
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We are facing the same issue. Looks like 6.7 code got updated for getPagesForComponent() in DefaultCMSPageService. There is no null check for slots in Dao, need to override this to perform the null check..
The issue is mainly because component doesn't assigned with any slot. If the component is assigned with the slot you can see editor as well as sync works.. Good luck !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I upgraded hybris from 6.0 to 6.6, all banner components cannot be edited in cmscockpit, error "Value is instanceof Collection but cannot be empty collection for key: contentSlots" , and when create a new banner component in existed rotaing image component, this new banner cannot be edit as well, is there any suggestuins for this issue?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
links are mendatory not optional.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I assume you got such error, because you are using instance of AbstractCMSComponent as link component (which must be assigned to some slots) instead of instance of CMSItem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I got the same issue but couldn't find a fix. One workaround is to create a dummy content slot and link it to the component. Then I am able to edit the component
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
I am facing a similar issue with a custom component, where Link component is used. How did you fix this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.