Validate.notNull(portletDefinitionId, "portletDefinitionId can not be null");
Validate.notEmpty(layoutNodeId, "layoutNodeId can not be null");
final IPortletDefinition portletDefinition = this.portletDefinitionDao.getPortletDefinition(portletDefinitionId);
if (portletDefinition == null) {
throw new DataRetrievalFailureException("No IPortletDefinition exists for IPortletDefinitionId='" + portletDefinitionId + "'");
}
IPortletEntity portletEntity = new PortletEntityImpl(portletDefinition, layoutNodeId, userId);
this.getEntityManager().persist(portletEntity);