我正在尝试掌握较新的编程模型(非Access Bean)。
在WebSphere Commerce 7 FEP 5中,如何计算从GetData标记中检索的对象的结构?
例如,在下面的代码段中,我如何知道catalogEntryDetails的数据结构是什么?班级名称,方法等?
还有人可以解释“metaData”字段的来源吗?应该是在名词定义中,还是在中介层的代码中设置的东西?我无法看到它作为名词定义中的直接字段的引用....
<c:forEach var="metadata" items="${catalogEntryDetails.metaData}" varStatus="status2">
<c:if test="${metadata.key == 'ThumbnailPath'}">
<c:set var="thumbNail" value="${env_imageContextPath}/${metadata.value}" />
</c:if>
<c:if test="${metadata.key == 'FullImagePath'}">
<c:set var="fullImage" value="${metadata.value}" />
</c:if>
</c:forEach>
catalogEntryDetails对象是从此代码段设置的:
<c:if test="${!empty productId}">
<%-- Try to get it from our internal hashMap --%>
<c:set var="key1" value="${productId}+getCatalogEntryViewAllByID"/>
<c:set var="catalogEntryDetails" value="${cachedCatalogEntryDetailsMap[key1]}"/>
<c:if test="${empty catalogEntryDetails}">
<wcf:getData type="com.ibm.commerce.catalog.facade.datatypes.CatalogNavigationViewType" var="catalogNavigationView"
expressionBuilder="getCatalogEntryViewAllByID" varShowVerb="showCatalogNavigationView" maxItems="1" recordSetStartNumber="0">
<wcf:param name="UniqueID" value="${productId}"/>
<wcf:contextData name="storeId" data="${storeId}" />
<wcf:contextData name="catalogId" data="${catalogId}" />
</wcf:getData>
<wcf:set target = "${cachedCatalogEntryDetailsMap}" key="${key1}" value="${catalogNavigationView.catalogEntryView[0]}"/>
</c:if>
</c:if>
<c:if test="${empty productId && !empty WCParam.partNumber}">
<c:set var="key1" value="${WCParam.partNumber}+getCatalogEntryViewAllByPartnumber"/>
<c:set var="catalogEntryDetails" value="${cachedCatalogEntryDetailsMap[key1]}"/>
<c:if test="${empty catalogEntryDetails}">
<wcf:getData type="com.ibm.commerce.catalog.facade.datatypes.CatalogNavigationViewType" var="catalogNavigationView"
expressionBuilder="getCatalogEntryViewAllByPartnumber" varShowVerb="showCatalogNavigationView" maxItems="1" recordSetStartNumber="0">
<wcf:param name="PartNumber" value="${WCParam.partNumber}" />
<wcf:contextData name="storeId" data="${storeId}" />
<wcf:contextData name="catalogId" data="${catalogId}" />
</wcf:getData>
<c:set var="catalogEntryDetails" value="${catalogNavigationView.catalogEntryView[0]}"/>
<wcf:set target = "${cachedCatalogEntryDetailsMap}" key="${key1}" value="${catalogNavigationView.catalogEntryView[0]}"/>
</c:if>
</c:if>
答案 0 :(得分:0)
您可以做的最好 - 检查IBM信息中心。 wcf:GetData文档告诉我们检索结果由“type”参数指定。在你的情况下,它是“com.ibm.commerce.catalog.facade.datatypes.CatalogNavigationViewType”。再次打开CatalogNavigationViewType的文档。文档告诉我们它的方法是getCatalogEntryView():
返回“目录条目视图”包含引用列表的值。列表内容的类型为CatalogEntryViewType。给定目录导航视图范围内的商品列表。
这就是你问题的答案: catalogEntryDetails是CatalogEntryViewType的一个实例。出于某种原因,我在IBM docs中找不到这个界面。但您仍然可以在com.ibm.commerce.catalog.facade.datatypes包中找到它(位于\ WCDE_ENT70 \ workspace \ WC \ Catalog-DataObjects.jar)
这是:
public interface CatalogEntryViewType
{
public abstract String getUniqueID();
public abstract void setUniqueID(String s);
public abstract String getPartNumber();
public abstract void setPartNumber(String s);
public abstract String getName();
public abstract void setName(String s);
public abstract String getThumbnail();
public abstract void setThumbnail(String s);
public abstract String getFullImage();
public abstract void setFullImage(String s);
public abstract String getShortDescription();
public abstract void setShortDescription(String s);
public abstract String getLongDescription();
public abstract void setLongDescription(String s);
public abstract String getManufacturer();
public abstract void setManufacturer(String s);
public abstract String getKeyword();
public abstract void setKeyword(String s);
public abstract boolean isHasSingleSKU();
public abstract void setHasSingleSKU(boolean flag);
public abstract void unsetHasSingleSKU();
public abstract boolean isSetHasSingleSKU();
public abstract String getSingleSKUCatalogEntryID();
public abstract void setSingleSKUCatalogEntryID(String s);
public abstract String getStoreID();
public abstract void setStoreID(String s);
public abstract List getAttachments();
public abstract List getPrice();
public abstract String getParentCatalogGroupID();
public abstract void setParentCatalogGroupID(String s);
public abstract String getParentCatalogEntryID();
public abstract void setParentCatalogEntryID(String s);
public abstract Map getMetaData();
public abstract UserDataType getUserData();
public abstract void setUserData(UserDataType userdatatype);
public abstract String getNumberOfSKUs();
public abstract void setNumberOfSKUs(String s);
public abstract List getSKUs();
public abstract List getComponents();
public abstract List getMerchandisingAssociations();
public abstract List getAttributes();
public abstract String getSubscriptionTypeCode();
public abstract void setSubscriptionTypeCode(String s);
public abstract String getDynamicKitURL();
public abstract void setDynamicKitURL(String s);
public abstract String getDynamicKitDefaultConfiguration();
public abstract void setDynamicKitDefaultConfiguration(String s);
public abstract boolean isDynamicKitDefaultConfigurationComplete();
public abstract void setDynamicKitDefaultConfigurationComplete(boolean flag);
public abstract void unsetDynamicKitDefaultConfigurationComplete();
public abstract boolean isSetDynamicKitDefaultConfigurationComplete();
public abstract String getDynamicKitModelReference();
public abstract void setDynamicKitModelReference(String s);
public abstract String getTitle();
public abstract void setTitle(String s);
public abstract String getMetaDescription();
public abstract void setMetaDescription(String s);
public abstract String getMetaKeyword();
public abstract void setMetaKeyword(String s);
public abstract String getFullImageAltDescription();
public abstract void setFullImageAltDescription(String s);
public abstract boolean isBuyable();
public abstract void setBuyable(boolean flag);
public abstract void unsetBuyable();
public abstract boolean isSetBuyable();
public abstract Object getCatalogEntryTypeCode();
public abstract void setCatalogEntryTypeCode(Object obj);
public abstract boolean isDisallowRecurringOrder();
public abstract void setDisallowRecurringOrder(boolean flag);
public abstract void unsetDisallowRecurringOrder();
public abstract boolean isSetDisallowRecurringOrder();
}
“metaData”字段来自此字符串:
public abstract Map getMetaData();
答案 1 :(得分:0)
是的,你是对的,它来自业务对象介体配置中配置的名词定义:WC \ xml \ config \ com.ibm.commerce.catalog-fep \ wc-business-object-mediator.xml。默认情况下,它由SolrReadCatalogEntryViewPartMediator构建。从任何文档中我都不清楚我必须反编译才能搞清楚。有趣: - (
<_config:part-mediator interfaceName="com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.ReadBusinessObjectPartMediator">
<_config:part-mediator-implementation className="com.ibm.commerce.catalog.facade.server.services.dataaccess.bom.mediator.solr.SolrReadCatalogEntryViewPartMediator" />
<_config:part-mediator-implementation className="com.ibm.commerce.catalog.facade.server.services.dataaccess.bom.mediator.solr.SolrReadCatalogGroupViewPartMediator" />
<_config:part-mediator-implementation className="com.ibm.commerce.catalog.facade.server.services.dataaccess.bom.mediator.solr.SolrReadAttachmentAssetViewPartMediator" />
<_config:part-mediator-implementation className="com.ibm.commerce.catalog.facade.server.services.dataaccess.bom.mediator.solr.SolrReadSuggestionViewPartMediator" />
<_config:part-mediator-implementation className="com.ibm.commerce.catalog.facade.server.services.dataaccess.bom.mediator.solr.SolrReadFacetViewPartMediator" />
<_config:part-mediator-implementation className="com.ibm.commerce.catalog.facade.server.services.dataaccess.bom.mediator.solr.SolrReadBreadCrumbTrailViewPartMediator" />
<_config:part-mediator-implementation className="com.ibm.commerce.catalog.facade.server.services.dataaccess.bom.mediator.solr.SolrReadWebContentViewPartMediator" />
<!--
Note: SolrReadCatalogNavigationViewPostMediator must be declared as the last entry.
-->
<_config:part-mediator-implementation className="com.ibm.commerce.catalog.facade.server.services.dataaccess.bom.mediator.solr.SolrReadCatalogNavigationViewPostMediator" />