コード例 #1
0
  public void updateFoo(
      long fooId,
      String field1,
      boolean field2,
      int field3,
      Date field4,
      String field5,
      ServiceContext serviceContext)
      throws PortalException, SystemException {

    User user = userPersistence.findByPrimaryKey(serviceContext.getUserId());

    Foo foo = fooPersistence.findByPrimaryKey(fooId);

    foo.setModifiedDate(new Date());
    foo.setField1(field1);
    foo.setField2(field2);
    foo.setField3(field3);
    foo.setField4(field4);
    foo.setField5(field5);
    foo.setExpandoBridgeAttributes(serviceContext);

    fooPersistence.update(foo, false);

    updateAsset(
        user.getUserId(),
        foo,
        serviceContext.getAssetCategoryIds(),
        serviceContext.getAssetTagNames());
  }
コード例 #2
0
  public void addFoo(
      String field1,
      boolean field2,
      int field3,
      Date field4,
      String field5,
      ServiceContext serviceContext)
      throws PortalException, SystemException {

    // Foo

    User user = userLocalService.getUserById(serviceContext.getUserId());
    long groupId = serviceContext.getScopeGroupId();
    Date now = new Date();

    long fooId = counterLocalService.increment();

    Foo foo = fooPersistence.create(fooId);

    foo.setGroupId(groupId);
    foo.setCompanyId(user.getCompanyId());
    foo.setUserId(user.getUserId());
    foo.setUserName(user.getFullName());
    foo.setCreateDate(serviceContext.getCreateDate(now));
    foo.setModifiedDate(serviceContext.getModifiedDate(now));
    foo.setField1(field1);
    foo.setField2(field2);
    foo.setField3(field3);
    foo.setField4(field4);
    foo.setField5(field5);
    foo.setExpandoBridgeAttributes(serviceContext);

    fooPersistence.update(foo, false);

    // Asset

    updateAsset(
        user.getUserId(),
        foo,
        serviceContext.getAssetCategoryIds(),
        serviceContext.getAssetTagNames());
  }