我正在尝试在 Tridion 2011 中编写存储扩展,我将在其中扩展JPAComponentPresentationDAO
和实现ComponentPresentationDAO
.
public void create(ComponentPresentation itemToCreate, ComponentPresentationTypeEnum componentPresentationType) throws StorageException
{
super.create(itemToCreate,componentPresentationType);
String tcmURI = Integer.toString(itemToCreate.getComponentId());
Component compObject // I want Component object to get the schema ID
PublishActionDAO publishActionDAO = (PublishActionDAO) StorageManagerFactory.getDefaultDAO("PublishAction");
PublishAction publishAction = new PublishAction();
publishAction.setAction("ADD");
publishAction.setTcmUri(tcmURI);
publishActionDAO.store(publishAction);
}
在上面的示例代码中,我想使用itemToCreate.getComponentId()
获取组件 ID 的位置创建 Component 对象,这样我就可以将一些有用的细节传递给我的实体类,该实体类会将这些数据存储在我的数据库表中。