//remove the persistent ID mapping after the delete
this.removePersistentId(portletEntityId);
//Setup an interim entity in its place
final IPortletDefinitionId portletDefinitionId = portletEntity.getPortletDefinitionId();
final String channelSubscribeId = portletEntity.getChannelSubscribeId();
final int userId = portletEntity.getUserId();
final IPortletEntity interimPortletEntity = this.createPortletEntity(portletDefinitionId, channelSubscribeId, userId);
if (this.logger.isTraceEnabled()) {
this.logger.trace("Persistent portlet entity " + portletEntityId + " no longer has preferences. Deleted it and created InterimPortletEntity " + interimPortletEntity.getPortletEntityId());
}
}
}
else {
//There are preferences on the interim entity, create an store it
if (preferences.size() > 0) {
final IPortletDefinitionId portletDefinitionId = portletEntity.getPortletDefinitionId();
final String channelSubscribeId = portletEntity.getChannelSubscribeId();
final int userId = portletEntity.getUserId();
final IPortletEntity persistantEntity = this.portletEntityDao.createPortletEntity(portletDefinitionId, channelSubscribeId, userId);
persistantEntity.setPortletPreferences(portletPreferences);