@Override public KaleoDefinition addKaleoDefinition( String name, String title, String description, String content, int version, ServiceContext serviceContext) throws PortalException { User user = userPersistence.findByPrimaryKey(serviceContext.getGuestOrUserId()); Date now = new Date(); long kaleoDefinitionId = counterLocalService.increment(); KaleoDefinition kaleoDefinition = kaleoDefinitionPersistence.create(kaleoDefinitionId); kaleoDefinition.setCompanyId(user.getCompanyId()); kaleoDefinition.setUserId(user.getUserId()); kaleoDefinition.setUserName(user.getFullName()); kaleoDefinition.setCreateDate(now); kaleoDefinition.setModifiedDate(now); kaleoDefinition.setName(name); kaleoDefinition.setTitle(title); kaleoDefinition.setDescription(description); kaleoDefinition.setContent(content); kaleoDefinition.setVersion(version); kaleoDefinition.setActive(false); kaleoDefinitionPersistence.update(kaleoDefinition); return kaleoDefinition; }
/** * Converts the soap model instance into a normal model instance. * * @param soapModel the soap model instance to convert * @return the normal model instance */ public static KaleoDefinition toModel(KaleoDefinitionSoap soapModel) { if (soapModel == null) { return null; } KaleoDefinition model = new KaleoDefinitionImpl(); model.setKaleoDefinitionId(soapModel.getKaleoDefinitionId()); model.setGroupId(soapModel.getGroupId()); model.setCompanyId(soapModel.getCompanyId()); model.setUserId(soapModel.getUserId()); model.setUserName(soapModel.getUserName()); model.setCreateDate(soapModel.getCreateDate()); model.setModifiedDate(soapModel.getModifiedDate()); model.setName(soapModel.getName()); model.setTitle(soapModel.getTitle()); model.setDescription(soapModel.getDescription()); model.setContent(soapModel.getContent()); model.setVersion(soapModel.getVersion()); model.setActive(soapModel.getActive()); model.setStartKaleoNodeId(soapModel.getStartKaleoNodeId()); return model; }