public Website addWebsite( long userId, String className, long classPK, String url, int typeId, boolean primary) throws PortalException, SystemException { User user = userPersistence.findByPrimaryKey(userId); long classNameId = PortalUtil.getClassNameId(className); Date now = new Date(); validate(0, user.getCompanyId(), classNameId, classPK, url, typeId, primary); long websiteId = counterLocalService.increment(); Website website = websitePersistence.create(websiteId); website.setCompanyId(user.getCompanyId()); website.setUserId(user.getUserId()); website.setUserName(user.getFullName()); website.setCreateDate(now); website.setModifiedDate(now); website.setClassNameId(classNameId); website.setClassPK(classPK); website.setUrl(url); website.setTypeId(typeId); website.setPrimary(primary); websitePersistence.update(website); return website; }
public Website updateWebsite(long websiteId, String url, int typeId, boolean primary) throws PortalException, SystemException { validate(websiteId, 0, 0, 0, url, typeId, primary); Website website = websitePersistence.findByPrimaryKey(websiteId); website.setModifiedDate(new Date()); website.setUrl(url); website.setTypeId(typeId); website.setPrimary(primary); websitePersistence.update(website); return website; }