{
try
{
byte[] portletData = importPortlet.getExportData();
ExportPortletData exportPortletData;
if (lifeTime != null)
{
long currentTime = toLongDate(lifeTime.getCurrentTime());
long terminationTime = toLongDate(lifeTime.getTerminationTime());
long refreshDuration = lifeTime.getRefreshDuration().getTimeInMillis(lifeTime.getCurrentTime().toGregorianCalendar());
exportPortletData = producer.getExportManager().createExportPortletData(exportContext, currentTime, terminationTime, refreshDuration, portletData);
}
else
{
exportPortletData = producer.getExportManager().createExportPortletData(exportContext, -1, -1, -1, portletData);
}
String portletHandle = exportPortletData.getPortletHandle();
byte[] portletState = exportPortletData.getPortletState();
PortletContext pc = WSRPTypeFactory.createPortletContext(portletHandle, portletState);
org.gatein.pc.api.PortletContext pcPortletContext = WSRPUtils.convertToPortalPortletContext(pc);
org.gatein.pc.api.PortletContext cpc = producer.getPortletInvoker().importPortlet(PortletStateType.OPAQUE, pcPortletContext);