Package com.liferay.docs.guestbook.model

Examples of com.liferay.docs.guestbook.model.Guestbook


  public static Guestbook toModel(GuestbookSoap soapModel) {
    if (soapModel == null) {
      return null;
    }

    Guestbook model = new GuestbookImpl();

    model.setUuid(soapModel.getUuid());
    model.setGuestbookId(soapModel.getGuestbookId());
    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());

    return model;
  }
View Full Code Here


    if (!(obj instanceof Guestbook)) {
      return false;
    }

    Guestbook guestbook = (Guestbook)obj;

    long primaryKey = guestbook.getPrimaryKey();

    if (getPrimaryKey() == primaryKey) {
      return true;
    }
    else {
View Full Code Here

    validate(name);

    long guestbookId = counterLocalService.increment();

    Guestbook guestbook = guestbookPersistence.create(guestbookId);

    guestbook.setUuid(serviceContext.getUuid());
    guestbook.setUserId(userId);
    guestbook.setGroupId(groupId);
    guestbook.setCompanyId(user.getCompanyId());
    guestbook.setUserName(user.getFullName());
    guestbook.setCreateDate(serviceContext.getCreateDate(now));
    guestbook.setModifiedDate(serviceContext.getModifiedDate(now));
    guestbook.setName(name);
    guestbook.setExpandoBridgeAttributes(serviceContext);

    guestbookPersistence.update(guestbook);

    resourceLocalService.addResources(user.getCompanyId(), groupId, userId,
        Guestbook.class.getName(), guestbookId, false, true, true);
   
    AssetEntry assetEntry = assetEntryLocalService.updateEntry(userId,
        groupId, guestbook.getCreateDate(),
        guestbook.getModifiedDate(), Guestbook.class.getName(),
        guestbookId, guestbook.getUuid(), 0,
        serviceContext.getAssetCategoryIds(),
        serviceContext.getAssetTagNames(), true, null, null, null,
        ContentTypes.TEXT_HTML, guestbook.getName(), null, null, null,
        null, 0, 0, null, false);
   
    assetLinkLocalService.updateLinks(userId, assetEntry.getEntryId(),
        serviceContext.getAssetLinkEntryIds(),
        AssetLinkConstants.TYPE_RELATED);
View Full Code Here

   */
  @Override
  public Guestbook findByUuid_First(String uuid,
    OrderByComparator orderByComparator)
    throws NoSuchGuestbookException, SystemException {
    Guestbook guestbook = fetchByUuid_First(uuid, orderByComparator);

    if (guestbook != null) {
      return guestbook;
    }

View Full Code Here

   */
  @Override
  public Guestbook findByUuid_Last(String uuid,
    OrderByComparator orderByComparator)
    throws NoSuchGuestbookException, SystemException {
    Guestbook guestbook = fetchByUuid_Last(uuid, orderByComparator);

    if (guestbook != null) {
      return guestbook;
    }

View Full Code Here

   */
  @Override
  public Guestbook[] findByUuid_PrevAndNext(long guestbookId, String uuid,
    OrderByComparator orderByComparator)
    throws NoSuchGuestbookException, SystemException {
    Guestbook guestbook = findByPrimaryKey(guestbookId);

    Session session = null;

    try {
      session = openSession();
View Full Code Here

   * @throws SystemException if a system exception occurred
   */
  @Override
  public Guestbook findByUUID_G(String uuid, long groupId)
    throws NoSuchGuestbookException, SystemException {
    Guestbook guestbook = fetchByUUID_G(uuid, groupId);

    if (guestbook == null) {
      StringBundler msg = new StringBundler(6);

      msg.append(_NO_SUCH_ENTITY_WITH_KEY);
View Full Code Here

      result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
          finderArgs, this);
    }

    if (result instanceof Guestbook) {
      Guestbook guestbook = (Guestbook)result;

      if (!Validator.equals(uuid, guestbook.getUuid()) ||
          (groupId != guestbook.getGroupId())) {
        result = null;
      }
    }

    if (result == null) {
      StringBundler query = new StringBundler(4);

      query.append(_SQL_SELECT_GUESTBOOK_WHERE);

      boolean bindUuid = false;

      if (uuid == null) {
        query.append(_FINDER_COLUMN_UUID_G_UUID_1);
      }
      else if (uuid.equals(StringPool.BLANK)) {
        query.append(_FINDER_COLUMN_UUID_G_UUID_3);
      }
      else {
        bindUuid = true;

        query.append(_FINDER_COLUMN_UUID_G_UUID_2);
      }

      query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        if (bindUuid) {
          qPos.add(uuid);
        }

        qPos.add(groupId);

        List<Guestbook> list = q.list();

        if (list.isEmpty()) {
          FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
            finderArgs, list);
        }
        else {
          Guestbook guestbook = list.get(0);

          result = guestbook;

          cacheResult(guestbook);

          if ((guestbook.getUuid() == null) ||
              !guestbook.getUuid().equals(uuid) ||
              (guestbook.getGroupId() != groupId)) {
            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
              finderArgs, guestbook);
          }
        }
      }
View Full Code Here

   * @throws SystemException if a system exception occurred
   */
  @Override
  public Guestbook removeByUUID_G(String uuid, long groupId)
    throws NoSuchGuestbookException, SystemException {
    Guestbook guestbook = findByUUID_G(uuid, groupId);

    return remove(guestbook);
  }
View Full Code Here

    Date now = new Date();

    validate(name);

    Guestbook guestbook = getGuestbook(guestbookId);
   
    User user = UserLocalServiceUtil.getUser(userId);

    guestbook.setUserId(userId);
    guestbook.setUserName(user.getFullName());
    guestbook.setModifiedDate(serviceContext.getModifiedDate(now));
    guestbook.setName(name);
    guestbook.setExpandoBridgeAttributes(serviceContext);

    guestbookPersistence.update(guestbook);

    resourceLocalService.updateResources(serviceContext.getCompanyId(),
        serviceContext.getScopeGroupId(), name, guestbookId,
        serviceContext.getGroupPermissions(),
        serviceContext.getGuestPermissions());
   
    AssetEntry assetEntry = assetEntryLocalService.updateEntry(guestbook.getUserId(),
        guestbook.getGroupId(), guestbook.getCreateDate(),
        guestbook.getModifiedDate(), Guestbook.class.getName(),
        guestbookId, guestbook.getUuid(), 0,
        serviceContext.getAssetCategoryIds(),
        serviceContext.getAssetTagNames(), true, null, null, null,
        ContentTypes.TEXT_HTML, guestbook.getName(), null, null, null,
        null, 0, 0, null, false);
   
    assetLinkLocalService.updateLinks(serviceContext.getUserId(),
        assetEntry.getEntryId(), serviceContext.getAssetLinkEntryIds(),
        AssetLinkConstants.TYPE_RELATED);
View Full Code Here

TOP

Related Classes of com.liferay.docs.guestbook.model.Guestbook

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.