repo
stringclasses
1k values
file_url
stringlengths
96
373
file_path
stringlengths
11
294
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
6 values
commit_sha
stringclasses
1k values
retrieved_at
stringdate
2026-01-04 14:45:56
2026-01-04 18:30:23
truncated
bool
2 classes
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/HistoryService.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/HistoryService.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service; import org.apache.paimon.web.server.data.model.History; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import org.apache.ibatis.annotations.Param; import java.util.List; /** History Service. */ public interface HistoryService extends IService<History> { /** * Saves a history record. * * @param history The selection history record to save * @return true if the record was saved successfully, false otherwise */ boolean saveHistory(History history); /** * Retrieves a paginated list of history records. * * @param page the pagination information * @param history the filter criteria * @return A list of History entities for the specified page */ List<History> listHistories(IPage<History> page, @Param("history") History history); }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/MetadataService.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/MetadataService.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service; import org.apache.paimon.web.server.data.dto.MetadataDTO; import org.apache.paimon.web.server.data.vo.DataFileVO; import org.apache.paimon.web.server.data.vo.ManifestsVO; import org.apache.paimon.web.server.data.vo.OptionVO; import org.apache.paimon.web.server.data.vo.SchemaVO; import org.apache.paimon.web.server.data.vo.SnapshotVO; import java.util.List; /** Metadata service includes the service interfaces of metadata. */ public interface MetadataService { /** * Retrieves a list of Metadata schema. * * @param dto query metadata info * @return a list of DatabaseInfo objects */ List<SchemaVO> getSchema(MetadataDTO dto); /** * Retrieves a list of Metadata snapshot. * * @param dto query metadata info * @return a list of snapshot objects */ List<SnapshotVO> getSnapshot(MetadataDTO dto); /** * Retrieves a list of Metadata manifest. * * @param dto query metadata info * @return a list of manifest info objects */ List<ManifestsVO> getManifest(MetadataDTO dto); /** * Retrieves a list of Metadata data file. * * @param dto query metadata info * @return a list of data file objects */ List<DataFileVO> getDataFile(MetadataDTO dto); /** * Retrieves a list of Metadata table option. * * @param dto query metadata info * @return a list of table option objects */ List<OptionVO> getOption(MetadataDTO dto); }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/UserRoleService.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/UserRoleService.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service; import org.apache.paimon.web.server.data.model.User; import org.apache.paimon.web.server.data.model.UserRole; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; /** UserRole Service. */ public interface UserRoleService extends IService<UserRole> { List<UserRole> selectUserRoleListByUserId(User user); }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/DatabaseService.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/DatabaseService.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service; import org.apache.paimon.web.server.data.dto.DatabaseDTO; import org.apache.paimon.web.server.data.vo.DatabaseVO; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; /** Database Service. */ public interface DatabaseService extends IService<DatabaseVO> { /** * Checks if the specified database exists. * * @param databaseDTO The database to check * @return true if the database exists, false otherwise */ boolean databaseExists(DatabaseDTO databaseDTO); /** * Creates a new database given {@link DatabaseDTO}. * * @param databaseDTO The {@link DatabaseDTO} object that contains the detail of the created * database * @return true if the operation is successful, false otherwise */ boolean createDatabase(DatabaseDTO databaseDTO); /** * Lists databases given catalog id. * * @return The list of databases of given catalog */ List<DatabaseVO> listDatabases(Integer catalogId); /** * Drops database given database name. * * @param databaseDTO The dropping database * @return true if the operation is successful, false otherwise */ boolean dropDatabase(DatabaseDTO databaseDTO); }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/RoleMenuService.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/RoleMenuService.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service; import org.apache.paimon.web.server.data.model.RoleMenu; import com.baomidou.mybatisplus.extension.service.IService; /** RoleMenu Service. */ public interface RoleMenuService extends IService<RoleMenu> {}
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/UserSessionManager.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/UserSessionManager.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service; import org.apache.paimon.web.engine.flink.sql.gateway.model.SessionEntity; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ConcurrentHashMap; /** Manages user sessions for Flink SQL Gateway. */ @Service public class UserSessionManager { private final ConcurrentHashMap<String, SessionEntity> sessions = new ConcurrentHashMap<>(); public SessionEntity getSession(String id) { return sessions.get(id); } public void addSession(String id, SessionEntity session) { sessions.put(id, session); } public void removeSession(String id) { sessions.remove(id); } public List<SessionEntity> getAllSessions() { return new ArrayList<>(sessions.values()); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/SessionService.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/SessionService.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service; import org.apache.paimon.web.engine.flink.sql.gateway.model.SessionEntity; import org.apache.paimon.web.server.data.dto.SessionDTO; /** Session Service. */ public interface SessionService { /** * Creates a new session. * * @param sessionDTO the data transfer object containing session details */ void createSession(SessionDTO sessionDTO); /** * Closes an existing session. * * @param sessionDTO the data transfer object containing session details */ void closeSession(SessionDTO sessionDTO); /** * Triggers a heartbeat update for a session. * * @param sessionDTO the data transfer object containing session details * @return the status code after triggering the heartbeat */ int triggerSessionHeartbeat(SessionDTO sessionDTO); /** * Retrieves the session for a given user ID within a specified cluster. * * @param uid the unique identifier of the user * @param clusterId the identifier of the cluster * @return the SessionEntity for the specified user and cluster, or null if no session is found */ SessionEntity getSession(Integer uid, Integer clusterId); }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/SysRoleServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/SysRoleServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.server.data.model.RoleMenu; import org.apache.paimon.web.server.data.model.SysRole; import org.apache.paimon.web.server.data.model.UserRole; import org.apache.paimon.web.server.data.result.exception.role.RoleInUsedException; import org.apache.paimon.web.server.mapper.RoleMenuMapper; import org.apache.paimon.web.server.mapper.SysRoleMapper; import org.apache.paimon.web.server.mapper.UserRoleMapper; import org.apache.paimon.web.server.service.SysRoleService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.base.Preconditions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; /** Role Service. */ @Service public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService { @Autowired private SysRoleMapper roleMapper; @Autowired private RoleMenuMapper roleMenuMapper; @Autowired private UserRoleMapper userRoleMapper; /** * Query role list. * * @param role query params * @return role list */ @Override public List<SysRole> listRoles(IPage<SysRole> page, SysRole role) { return roleMapper.selectRoleList(page, role); } /** * Query role list by user ID. * * @param userId user ID * @return role list */ @Override public List<SysRole> selectRolesByUserId(Integer userId) { List<SysRole> userRoles = roleMapper.selectRolePermissionByUserId(userId); List<SysRole> roles = this.list(); for (SysRole role : roles) { for (SysRole userRole : userRoles) { if (role.getId().intValue() == userRole.getId().intValue()) { role.setFlag(true); break; } } } return roles; } /** * Query role permission by user ID. * * @param userId user ID * @return permission list */ @Override public Set<String> selectRolePermissionByUserId(Integer userId) { List<SysRole> perms = roleMapper.selectRolePermissionByUserId(userId); Set<String> permsSet = new HashSet<>(); for (SysRole perm : perms) { if (perm != null) { permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); } } return permsSet; } /** * Query role list by user ID. * * @param userId user ID * @return role IDs */ @Override public List<Integer> selectRoleListByUserId(Integer userId) { return roleMapper.selectRoleListByUserId(userId); } /** * Query role info by role ID. * * @param roleId role ID * @return role info */ @Override public SysRole getRoleById(Integer roleId) { return this.getById(roleId); } /** * Verify if the role name is unique. * * @param role role info * @return result */ @Override public boolean checkRoleNameUnique(SysRole role) { int roleId = role.getId() == null ? -1 : role.getId(); SysRole info = this.lambdaQuery().eq(SysRole::getRoleName, role.getRoleName()).one(); return info == null || info.getId() == roleId; } /** * Verify whether role permissions are unique. * * @param role role info * @return result */ @Override public boolean checkRoleKeyUnique(SysRole role) { int roleId = role.getId() == null ? -1 : role.getId(); SysRole info = this.lambdaQuery().eq(SysRole::getRoleKey, role.getRoleKey()).one(); return info == null || info.getId() == roleId; } /** * Verify whether the role allows operations. * * @param role role info */ @Override public boolean checkRoleAllowed(SysRole role) { return role.getId() != null && role.getId() == 1; } /** * Add role. * * @param role role info * @return result */ @Override @Transactional(rollbackFor = Exception.class) public int insertRole(SysRole role) { List<SysRole> list = this.list(); role.setSort(list.size() + 1); this.save(role); return insertRoleMenu(role); } /** * Update role. * * @param role role info * @return result */ @Override @Transactional(rollbackFor = Exception.class) public int updateRole(SysRole role) { this.updateById(role); roleMenuMapper.deleteRoleMenuByRoleId(role.getId()); return insertRoleMenu(role); } /** * Add role-menu association information. * * @param role role info */ public int insertRoleMenu(SysRole role) { Integer[] mergedMenuIds = mergeMenuIds(role.getMenuIds(), role.getIndeterminateKeys()); int rows = 1; if (mergedMenuIds.length > 0) { List<RoleMenu> list = new ArrayList<RoleMenu>(); for (Integer menuId : mergedMenuIds) { RoleMenu rm = new RoleMenu(); rm.setRoleId(role.getId()); rm.setMenuId(menuId); list.add(rm); } rows = roleMenuMapper.batchRoleMenu(list); } return rows; } private Integer[] mergeMenuIds(Integer[] menuIds, Integer[] indeterminateKeys) { Set<Integer> mergedSet = new HashSet<>(); if (menuIds != null) { mergedSet.addAll(Arrays.asList(menuIds)); } if (indeterminateKeys != null) { mergedSet.addAll(Arrays.asList(indeterminateKeys)); } return mergedSet.toArray(new Integer[0]); } /** * Delete role. * * @param roleId role ID * @return result */ @Override @Transactional(rollbackFor = Exception.class) public int deleteRoleById(Integer roleId) { roleMenuMapper.deleteRoleMenuByRoleId(roleId); return roleMapper.deleteById(roleId); } /** * Batch delete role. * * @param roleIds role IDs * @return result */ @Override @Transactional(rollbackFor = Exception.class) public int deleteRoleByIds(Integer[] roleIds) { for (Integer roleId : roleIds) { SysRole sysRole = new SysRole(); sysRole.setId(roleId); checkRoleAllowed(sysRole); SysRole role = getRoleById(roleId); if (countUserRoleByRoleId(roleId) > 0) { throw new RoleInUsedException(role.getRoleName()); } } roleMenuMapper.deleteRoleMenu(roleIds); return roleMapper.deleteBatchIds(Arrays.asList(roleIds)); } /** * Unauthorize user role. * * @param userRole user-role association * @return result */ @Override public int deleteAuthUser(UserRole userRole) { return userRoleMapper.deleteById(userRole); } /** * Batch unauthorize user role. * * @param roleId role ID * @param userIds user IDs * @return result */ @Override public int deleteAuthUsers(Integer roleId, Integer[] userIds) { return userRoleMapper.deleteUserRoleInfos(roleId, userIds); } /** * Batch add role-menu association information. * * @param roleId role ID * @param userIds user IDs * @return result */ @Override public int insertAuthUsers(Integer roleId, Integer[] userIds) { List<UserRole> list = new ArrayList<UserRole>(); for (Integer userId : userIds) { UserRole ur = new UserRole(); ur.setUserId(userId); ur.setRoleId(roleId); list.add(ur); } return userRoleMapper.batchUserRole(list); } /** * Query the number of roles used by role ID. * * @param roleId role ID * @return result */ @Override public int countUserRoleByRoleId(Integer roleId) { return userRoleMapper .selectCount(new QueryWrapper<UserRole>().eq("role_id", roleId)) .intValue(); } @Override public boolean updateRoleStatus(SysRole role) { Preconditions.checkArgument(role != null && role.getId() != null); return this.lambdaUpdate() .set(SysRole::getEnabled, role.getEnabled()) .eq(SysRole::getId, role.getId()) .update(); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/DatabaseServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/DatabaseServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.api.catalog.PaimonService; import org.apache.paimon.web.server.data.dto.DatabaseDTO; import org.apache.paimon.web.server.data.model.CatalogInfo; import org.apache.paimon.web.server.data.vo.DatabaseVO; import org.apache.paimon.web.server.mapper.DatabaseMapper; import org.apache.paimon.web.server.service.CatalogService; import org.apache.paimon.web.server.service.DatabaseService; import org.apache.paimon.web.server.util.PaimonServiceUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.BooleanUtils; import org.springframework.stereotype.Service; import java.util.LinkedList; import java.util.List; import java.util.Objects; /** The implementation of {@link DatabaseService}. */ @Service public class DatabaseServiceImpl extends ServiceImpl<DatabaseMapper, DatabaseVO> implements DatabaseService { private final CatalogService catalogService; public DatabaseServiceImpl(CatalogService catalogService) { this.catalogService = catalogService; } @Override public boolean databaseExists(DatabaseDTO databaseDTO) { CatalogInfo catalogInfo = getCatalogInfo(databaseDTO); PaimonService service = PaimonServiceUtils.getPaimonService(catalogInfo); return service.databaseExists(databaseDTO.getName()); } @Override public boolean createDatabase(DatabaseDTO databaseDTO) { try { CatalogInfo catalogInfo = getCatalogInfo(databaseDTO); PaimonService service = PaimonServiceUtils.getPaimonService(catalogInfo); service.createDatabase( databaseDTO.getName(), BooleanUtils.toBooleanDefaultIfNull(databaseDTO.isIgnoreIfExists(), false)); return true; } catch (Exception e) { log.error("Exception with creating database.", e); return false; } } @Override public List<DatabaseVO> listDatabases(Integer catalogId) { List<DatabaseVO> resultList = new LinkedList<>(); if (Objects.nonNull(catalogId)) { CatalogInfo catalog = catalogService.getById(catalogId); PaimonService service = PaimonServiceUtils.getPaimonService(catalog); List<String> databases = service.listDatabases(); databases.forEach( databaseName -> { DatabaseVO database = new DatabaseVO(); database.setName(databaseName); database.setCatalogId(catalog.getId()); database.setCatalogName(catalog.getCatalogName()); database.setDescription(""); resultList.add(database); }); return resultList; } else { List<CatalogInfo> catalogInfoList = catalogService.list(); if (!CollectionUtils.isEmpty(catalogInfoList)) { catalogInfoList.forEach( item -> { PaimonService service = PaimonServiceUtils.getPaimonService(item); List<String> list = service.listDatabases(); list.forEach( databaseName -> { DatabaseVO info = DatabaseVO.builder() .name(databaseName) .catalogId(item.getId()) .catalogName(item.getCatalogName()) .description("") .build(); resultList.add(info); }); }); } return resultList; } } @Override public boolean dropDatabase(DatabaseDTO databaseDTO) { try { CatalogInfo catalogInfo = getCatalogInfo(databaseDTO); PaimonService service = PaimonServiceUtils.getPaimonService(catalogInfo); service.dropDatabase( databaseDTO.getName(), BooleanUtils.toBooleanDefaultIfNull(databaseDTO.isIgnoreIfExists(), false), BooleanUtils.toBooleanDefaultIfNull(databaseDTO.isCascade(), true)); return true; } catch (Exception e) { log.error("Exception with dropping database.", e); return false; } } /** * Retrieves the associated CatalogInfo object based on the given catalog id. * * @param databaseDTO The database DTO. * @return The associated CatalogInfo object, or null if it doesn't exist. */ private CatalogInfo getCatalogInfo(DatabaseDTO databaseDTO) { CatalogInfo catalogInfo; if (databaseDTO.getCatalogId() != null) { catalogInfo = catalogService.getOne( Wrappers.lambdaQuery(CatalogInfo.class) .eq(CatalogInfo::getId, databaseDTO.getCatalogId())); } else { catalogInfo = catalogService.getOne( Wrappers.lambdaQuery(CatalogInfo.class) .eq(CatalogInfo::getCatalogName, databaseDTO.getCatalogName())); } Objects.requireNonNull( catalogInfo, String.format("Catalog: [%s] is not found.", databaseDTO.getCatalogName())); return catalogInfo; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/MetadataServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/MetadataServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.data.InternalRow; import org.apache.paimon.reader.RecordReader; import org.apache.paimon.table.Table; import org.apache.paimon.table.source.ReadBuilder; import org.apache.paimon.web.api.catalog.PaimonService; import org.apache.paimon.web.server.constant.MetadataConstant; import org.apache.paimon.web.server.data.dto.MetadataDTO; import org.apache.paimon.web.server.data.model.CatalogInfo; import org.apache.paimon.web.server.data.model.MetadataFieldsModel; import org.apache.paimon.web.server.data.model.MetadataOptionModel; import org.apache.paimon.web.server.data.vo.DataFileVO; import org.apache.paimon.web.server.data.vo.ManifestsVO; import org.apache.paimon.web.server.data.vo.OptionVO; import org.apache.paimon.web.server.data.vo.SchemaVO; import org.apache.paimon.web.server.data.vo.SnapshotVO; import org.apache.paimon.web.server.service.CatalogService; import org.apache.paimon.web.server.service.MetadataService; import org.apache.paimon.web.server.util.PaimonServiceUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import java.io.IOException; import java.time.LocalDateTime; import java.util.LinkedList; import java.util.List; import java.util.Map; /** The implementation of {@link MetadataService}. */ @Service @Slf4j public class MetadataServiceImpl implements MetadataService { private final CatalogService catalogService; public MetadataServiceImpl(CatalogService catalogService) { this.catalogService = catalogService; } private RecordReader<InternalRow> reader; @Override public List<SchemaVO> getSchema(MetadataDTO dto) { initEnvironment(dto, MetadataConstant.SCHEMAS); List<SchemaVO> result = new LinkedList<>(); try { reader.forEachRemaining( internalRow -> { SchemaVO schemaVo = SchemaVO.builder() .schemaId(internalRow.getLong(0)) .fields( new Gson() .fromJson( internalRow.getString(1).toString(), new TypeToken< LinkedList< MetadataFieldsModel>>() {})) .partitionKeys(getSafeString(internalRow, 2)) .primaryKeys(getSafeString(internalRow, 3)) .option(formatOptions(getSafeString(internalRow, 4))) .comment(getSafeString(internalRow, 5)) .updateTime(getSafeLocalDateTime(internalRow, 6)) .build(); result.add(schemaVo); }); } catch (IOException e) { throw new RuntimeException(e); } return result; } @Override public List<SnapshotVO> getSnapshot(MetadataDTO dto) { initEnvironment(dto, MetadataConstant.SNAPSHOTS); List<SnapshotVO> result = new LinkedList<>(); try { reader.forEachRemaining( internalRow -> { SnapshotVO build = SnapshotVO.builder() .snapshotId(internalRow.getLong(0)) .schemaId(internalRow.getLong(1)) .commitUser(getSafeString(internalRow, 2)) .commitIdentifier(internalRow.getLong(3)) .commitKind(getSafeString(internalRow, 4)) .commitTime(getSafeLocalDateTime(internalRow, 5)) .baseManifestList(getSafeString(internalRow, 6)) .deltaManifestList(getSafeString(internalRow, 7)) .changelogManifestList(getSafeString(internalRow, 8)) .totalRecordCount(internalRow.getLong(9)) .deltaRecordCount(internalRow.getLong(10)) .changelogRecordCount(internalRow.getLong(11)) .watermark(getSafeLong(internalRow, 12)) .build(); result.add(build); }); } catch (IOException e) { throw new RuntimeException(e); } return result; } @Override public List<ManifestsVO> getManifest(MetadataDTO dto) { initEnvironment(dto, MetadataConstant.MANIFESTS); List<ManifestsVO> result = new LinkedList<>(); try { reader.forEachRemaining( internalRow -> { ManifestsVO manifestsVo = ManifestsVO.builder() .fileName(getSafeString(internalRow, 0)) .fileSize(internalRow.getLong(1)) .numAddedFiles(internalRow.getLong(2)) .numDeletedFiles(internalRow.getLong(3)) .schemaId(internalRow.getLong(4)) .build(); result.add(manifestsVo); }); } catch (IOException e) { throw new RuntimeException(e); } return result; } @Override public List<DataFileVO> getDataFile(MetadataDTO dto) { initEnvironment(dto, MetadataConstant.FILES); List<DataFileVO> result = new LinkedList<>(); try { reader.forEachRemaining( internalRow -> { DataFileVO dataFileVO = DataFileVO.builder() .partition(getSafeString(internalRow, 0)) .bucket(internalRow.getInt(1)) .filePath(getSafeString(internalRow, 2)) .fileFormat(getSafeString(internalRow, 3)) .schemaId(internalRow.getLong(4)) .level(internalRow.getInt(5)) .recordCount(internalRow.getLong(6)) .fileSizeInBytes(internalRow.getLong(7)) .minKey(getSafeString(internalRow, 8)) .maxKey(getSafeString(internalRow, 9)) .nullValueCounts(getSafeString(internalRow, 10)) .minValueStats(getSafeString(internalRow, 11)) .maxValueStats(getSafeString(internalRow, 12)) .minSequenceNumber(internalRow.getLong(13)) .maxSequenceNumber(internalRow.getLong(14)) .creationTime(getSafeLocalDateTime(internalRow, 15)) .build(); result.add(dataFileVO); }); } catch (IOException e) { throw new RuntimeException(e); } return result; } @Override public List<OptionVO> getOption(MetadataDTO dto) { initEnvironment(dto, MetadataConstant.OPTIONS); List<OptionVO> result = new LinkedList<>(); try { reader.forEachRemaining( internalRow -> { OptionVO optionVo = new OptionVO(); optionVo.setKey(internalRow.getString(0).toString()); optionVo.setValue(internalRow.getString(1).toString()); result.add(optionVo); }); } catch (IOException e) { throw new RuntimeException(e); } return result; } private void initEnvironment(MetadataDTO dto, String metadataConstantType) { dto.setTableName( String.format( MetadataConstant.METADATA_TABLE_FORMAT, dto.getTableName(), metadataConstantType)); CatalogInfo catalogInfo = catalogService.getOne( Wrappers.lambdaQuery(CatalogInfo.class) .eq(CatalogInfo::getId, dto.getCatalogId()) .select(i -> true)); PaimonService paimonService = PaimonServiceUtils.getPaimonService(catalogInfo); Table table = paimonService.getTable(dto.getDatabaseName(), dto.getTableName()); this.reader = getReader(table); } private List<MetadataOptionModel> formatOptions(String jsonOption) { Gson gson = new Gson(); Map<String, Object> map = gson.fromJson(jsonOption, new TypeToken<Map<String, Object>>() {}); List<MetadataOptionModel> result = new LinkedList<>(); for (Object key : map.keySet()) { result.add(new MetadataOptionModel(key.toString(), map.get(key))); } return result; } private static RecordReader<InternalRow> getReader(Table table) { ReadBuilder readBuilder = table.newReadBuilder(); try (RecordReader<InternalRow> reader = readBuilder.newRead().createReader(readBuilder.newScan().plan())) { return reader; } catch (IOException e) { throw new RuntimeException(e); } } private String getSafeString(InternalRow internalRow, int index) { return internalRow.isNullAt(index) ? "" : internalRow.getString(index).toString(); } private Long getSafeLong(InternalRow internalRow, int index) { return internalRow.isNullAt(index) ? null : internalRow.getLong(index); } private LocalDateTime getSafeLocalDateTime(InternalRow internalRow, int index) { return internalRow.isNullAt(index) ? null : internalRow.getTimestamp(index, 3).toLocalDateTime(); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/LdapServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/LdapServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.server.data.enums.UserType; import org.apache.paimon.web.server.data.model.User; import org.apache.paimon.web.server.service.LdapService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.ldap.core.AttributesMapper; import org.springframework.ldap.core.LdapTemplate; import org.springframework.ldap.filter.EqualsFilter; import org.springframework.ldap.query.LdapQuery; import org.springframework.ldap.query.LdapQueryBuilder; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import javax.naming.NamingException; import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import java.util.List; import java.util.Optional; /** ldap service impl. */ @Slf4j @Service public class LdapServiceImpl implements LdapService { private static final UserAttributesMapperMapper MAPPER = new UserAttributesMapperMapper(); private static final String FILTER = "cn"; @Autowired private LdapTemplate ldapTemplate; /** * get user info by ldap user identification. * * @param uid login name of ldap user * @return {@link Optional} of {@link User} when user not exist then return {@link * Optional#empty()} */ @Override public Optional<User> getUser(String uid) { LdapQuery query = LdapQueryBuilder.query().where(FILTER).is(uid); try { List<User> users = ldapTemplate.search(query, MAPPER); return CollectionUtils.isEmpty(users) ? Optional.empty() : Optional.ofNullable(users.get(0)); } catch (EmptyResultDataAccessException e) { return Optional.empty(); } } /** * authenticate by ldap. * * @param name login name of ldap user * @param password login password of ldap user * @return {@link Optional} of {@link User} when user authenticate failed then return {@link * Optional#empty()} */ @Override public Optional<User> authenticate(String name, String password) { EqualsFilter filter = new EqualsFilter(FILTER, name); if (ldapTemplate.authenticate(StringUtils.EMPTY, filter.toString(), password)) { return this.getUser(name); } return Optional.empty(); } /** Attributes mapper from LDAP user to Local user. */ private static class UserAttributesMapperMapper implements AttributesMapper<User> { /** * Map the LDAP attributes to User object. * * @param attributes LDAP attributes * @return User object * @throws NamingException if there is an error during mapping */ @Override public User mapFromAttributes(Attributes attributes) throws NamingException { Attribute usernameAttr = attributes.get(FILTER); Attribute nicknameAttr = attributes.get("sn"); Attribute email = attributes.get("email"); if (usernameAttr != null && nicknameAttr != null) { User user = new User(); user.setUsername(usernameAttr.get().toString()); user.setNickname(nicknameAttr.get().toString()); user.setEmail( Optional.ofNullable(email) .map( e -> { try { return e.get().toString(); } catch (NamingException ignore) { } return StringUtils.EMPTY; }) .orElse(StringUtils.EMPTY)); user.setUserType(UserType.LDAP); user.setEnabled(true); return user; } return null; } } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/UserRoleServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/UserRoleServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.server.data.model.User; import org.apache.paimon.web.server.data.model.UserRole; import org.apache.paimon.web.server.mapper.UserRoleMapper; import org.apache.paimon.web.server.service.UserRoleService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; import java.util.List; /** UserRoleServiceImpl. */ @Service public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> implements UserRoleService { @Override public List<UserRole> selectUserRoleListByUserId(User user) { return list(new LambdaQueryWrapper<UserRole>().eq(UserRole::getUserId, user.getId())); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/TableServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/TableServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.table.Table; import org.apache.paimon.types.DataField; import org.apache.paimon.web.api.catalog.PaimonService; import org.apache.paimon.web.api.table.TableChange; import org.apache.paimon.web.api.table.metadata.ColumnMetadata; import org.apache.paimon.web.api.table.metadata.TableMetadata; import org.apache.paimon.web.server.data.dto.AlterTableDTO; import org.apache.paimon.web.server.data.dto.TableDTO; import org.apache.paimon.web.server.data.model.CatalogInfo; import org.apache.paimon.web.server.data.model.TableColumn; import org.apache.paimon.web.server.data.vo.TableVO; import org.apache.paimon.web.server.service.CatalogService; import org.apache.paimon.web.server.service.TableService; import org.apache.paimon.web.server.util.DataTypeConvertUtils; import org.apache.paimon.web.server.util.PaimonDataType; import org.apache.paimon.web.server.util.PaimonServiceUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; /** The implementation of {@link TableService}. */ @Slf4j @Service public class TableServiceImpl implements TableService { private static final String FIELDS_PREFIX = "FIELDS"; private static final String DEFAULT_VALUE_SUFFIX = "default-value"; private final CatalogService catalogService; public TableServiceImpl(CatalogService catalogService) { this.catalogService = catalogService; } @Override public boolean tableExists(TableDTO tableDTO) { PaimonService service = PaimonServiceUtils.getPaimonService(getCatalogInfo(tableDTO.getCatalogName())); return service.tableExists(tableDTO.getDatabaseName(), tableDTO.getName()); } @Override public boolean createTable(TableDTO tableDTO) { try { PaimonService service = PaimonServiceUtils.getPaimonService(getCatalogInfo(tableDTO.getCatalogName())); List<String> partitionKeys = tableDTO.getPartitionKey(); Map<String, String> tableOptions = tableDTO.getTableOptions(); List<TableColumn> tableColumns = tableDTO.getTableColumns(); if (!CollectionUtils.isEmpty(tableColumns)) { for (TableColumn tableColumn : tableColumns) { if (tableColumn.getDefaultValue() != null && !tableColumn.getDefaultValue().isEmpty()) { tableOptions.put( FIELDS_PREFIX + "." + tableColumn.getField() + "." + DEFAULT_VALUE_SUFFIX, tableColumn.getDefaultValue()); } } } TableMetadata.Builder builder = TableMetadata.builder() .columns(buildColumns(tableDTO)) .primaryKeys(buildPrimaryKeys(tableDTO)); if (CollectionUtils.isNotEmpty(partitionKeys)) { builder.partitionKeys(partitionKeys); } if (MapUtils.isNotEmpty(tableOptions)) { builder.options(tableOptions); } if (StringUtils.isNotEmpty(tableDTO.getDescription())) { builder.comment(tableDTO.getDescription()); } service.createTable(tableDTO.getDatabaseName(), tableDTO.getName(), builder.build()); return true; } catch (Exception e) { log.error("Exception with creating table.", e); return false; } } @Override public boolean addColumn(TableDTO tableDTO) { try { PaimonService service = PaimonServiceUtils.getPaimonService(getCatalogInfo(tableDTO.getCatalogName())); List<TableColumn> tableColumns = tableDTO.getTableColumns(); List<TableChange> tableChanges = new ArrayList<>(); Map<String, String> options = new HashMap<>(); for (TableColumn tableColumn : tableColumns) { if (tableColumn.getDefaultValue() != null && !tableColumn.getDefaultValue().isEmpty()) { options.put( FIELDS_PREFIX + "." + tableColumn.getField() + "." + DEFAULT_VALUE_SUFFIX, tableColumn.getDefaultValue()); } ColumnMetadata columnMetadata = new ColumnMetadata( tableColumn.getField(), DataTypeConvertUtils.convert( new PaimonDataType( tableColumn.getDataType().getType(), true, tableColumn.getDataType().getPrecision(), tableColumn.getDataType().getScale())), tableColumn.getComment()); TableChange.AddColumn add = TableChange.add(columnMetadata); tableChanges.add(add); } if (!options.isEmpty()) { for (Map.Entry<String, String> entry : options.entrySet()) { TableChange.SetOption setOption = TableChange.set(entry.getKey(), entry.getValue()); tableChanges.add(setOption); } } service.alterTable(tableDTO.getDatabaseName(), tableDTO.getName(), tableChanges); return true; } catch (Exception e) { log.error("Exception with adding column.", e); return false; } } @Override public boolean dropColumn( String catalogName, String databaseName, String tableName, String columnName) { try { PaimonService service = PaimonServiceUtils.getPaimonService(getCatalogInfo(catalogName)); List<TableChange> tableChanges = new ArrayList<>(); TableChange.DropColumn dropColumn = TableChange.dropColumn(columnName); tableChanges.add(dropColumn); service.alterTable(databaseName, tableName, tableChanges); return true; } catch (Exception e) { log.error("Exception with dropping column.", e); return false; } } @Override public boolean alterTable(AlterTableDTO alterTableDTO) { try { String databaseName = alterTableDTO.getDatabaseName(); String tableName = alterTableDTO.getTableName(); PaimonService service = PaimonServiceUtils.getPaimonService( getCatalogInfo(alterTableDTO.getCatalogName())); Table table = service.getTable(databaseName, tableName); List<DataField> fields = table.rowType().getFields(); Map<Integer, DataField> oldFieldsMap = fields.stream().collect(Collectors.toMap(DataField::id, Function.identity())); Map<String, String> options = table.options(); Map<Integer, Integer> fieldIdIndexMap = new HashMap<>(); for (int i = 0; i < fields.size(); i++) { fieldIdIndexMap.put(fields.get(i).id(), i); } List<TableChange> tableChanges = new ArrayList<>(); List<TableColumn> tableColumns = alterTableDTO.getTableColumns(); tableColumns.sort(Comparator.comparing(TableColumn::getSort)); Map<Integer, String> tableColumnIndexMap = new HashMap<>(); for (int i = 0; i < tableColumns.size(); i++) { tableColumnIndexMap.put(i, tableColumns.get(i).getField()); } for (TableColumn tableColumn : tableColumns) { DataField dataField = oldFieldsMap.get(tableColumn.getId()); addTableChanges( tableColumn, dataField, options, fieldIdIndexMap, tableColumnIndexMap, tableChanges); } if (!tableChanges.isEmpty()) { service.alterTable(databaseName, tableName, tableChanges); } return true; } catch (Exception e) { log.error("Exception with altering table.", e); return false; } } @Override public boolean addOption(TableDTO tableDTO) { List<TableChange> tableChanges = new ArrayList<>(); try { PaimonService service = PaimonServiceUtils.getPaimonService(getCatalogInfo(tableDTO.getCatalogName())); Map<String, String> tableOptions = tableDTO.getTableOptions(); for (Map.Entry<String, String> entry : tableOptions.entrySet()) { TableChange.SetOption setOption = TableChange.set(entry.getKey(), entry.getValue()); tableChanges.add(setOption); } service.alterTable(tableDTO.getDatabaseName(), tableDTO.getName(), tableChanges); return true; } catch (Exception e) { log.error("Exception with adding option.", e); return false; } } @Override public boolean removeOption( String catalogName, String databaseName, String tableName, String key) { List<TableChange> tableChanges = new ArrayList<>(); try { PaimonService service = PaimonServiceUtils.getPaimonService(getCatalogInfo(catalogName)); TableChange.RemoveOption removeOption = TableChange.remove(key); tableChanges.add(removeOption); service.alterTable(databaseName, tableName, tableChanges); return true; } catch (Exception e) { log.error("Exception with removing option.", e); return false; } } @Override public boolean dropTable(String catalogName, String databaseName, String tableName) { try { PaimonService service = PaimonServiceUtils.getPaimonService(getCatalogInfo(catalogName)); service.dropTable(databaseName, tableName); return true; } catch (Exception e) { log.error("Exception with dropping table.", e); return false; } } @Override public boolean renameTable( String catalogName, String databaseName, String fromTableName, String toTableName) { try { PaimonService service = PaimonServiceUtils.getPaimonService(getCatalogInfo(catalogName)); service.renameTable(databaseName, fromTableName, toTableName); return true; } catch (Exception e) { log.error("Exception with renaming table.", e); return false; } } @Override public List<TableVO> listTables(TableDTO tableDTO) { List<TableVO> resultList = new LinkedList<>(); List<CatalogInfo> catalogInfoList = catalogService.list(); PaimonService paimonService; for (CatalogInfo catalog : catalogInfoList) { if (Objects.nonNull(tableDTO.getCatalogId()) && Objects.nonNull(tableDTO.getDatabaseName()) && catalog.getId().equals(tableDTO.getCatalogId())) { paimonService = PaimonServiceUtils.getPaimonService(catalog); List<String> tables = paimonService.listTables(tableDTO.getDatabaseName()); tables.forEach( name -> { TableVO table = new TableVO(); table.setCatalogId(catalog.getId()); table.setCatalogName(catalog.getCatalogName()); table.setName(name); table.setDatabaseName(tableDTO.getDatabaseName()); resultList.add(table); }); break; } if (Objects.nonNull(tableDTO.getName())) { paimonService = PaimonServiceUtils.getPaimonService(catalog); List<String> databaseList = paimonService.listDatabases(); for (String database : databaseList) { List<String> tables = paimonService.listTables(database); tables.forEach( tableName -> { if (tableName.contains(tableDTO.getName())) { TableVO table = new TableVO(); table.setCatalogId(catalog.getId()); table.setCatalogName(catalog.getCatalogName()); table.setDatabaseName(database); table.setName(tableName); resultList.add(table); } }); } } } return resultList; } @Override public TableVO listColumns(String catalogName, String databaseName, String tableName) { PaimonService service = PaimonServiceUtils.getPaimonService(getCatalogInfo(catalogName)); Table table = service.getTable(databaseName, tableName); TableVO.TableVOBuilder builder = TableVO.builder() .catalogName(catalogName) .databaseName(databaseName) .name(tableName); if (Objects.nonNull(table)) { List<String> primaryKeys = table.primaryKeys(); List<DataField> fields = table.rowType().getFields(); List<TableColumn> tableColumns = new ArrayList<>(); Map<String, String> options = table.options(); if (CollectionUtils.isNotEmpty(fields)) { for (DataField field : fields) { String key = FIELDS_PREFIX + "." + field.name() + "." + DEFAULT_VALUE_SUFFIX; TableColumn.TableColumnBuilder columnBuilder = TableColumn.builder() .id(field.id()) .field(field.name()) .sort(field.id()) .dataType(DataTypeConvertUtils.fromPaimonType(field.type())) .comment(field.description()); if (CollectionUtils.isNotEmpty(primaryKeys) && primaryKeys.contains(field.name())) { columnBuilder.isPk(true); } if (options.get(key) != null) { columnBuilder.defaultValue(options.get(key)); } tableColumns.add(columnBuilder.build()); } } builder.columns(tableColumns).partitionKey(table.partitionKeys()); } return builder.build(); } private void addTableChanges( TableColumn tableColumn, DataField dataField, Map<String, String> options, Map<Integer, Integer> fieldIdIndexMap, Map<Integer, String> tableColumnIndexMap, List<TableChange> tableChanges) { if (!Objects.equals(tableColumn.getField(), dataField.name())) { ColumnMetadata columnMetadata = new ColumnMetadata(dataField.name(), dataField.type(), dataField.description()); TableChange.ModifyColumnName modifyColumnName = TableChange.modifyColumnName(columnMetadata, tableColumn.getField()); tableChanges.add(modifyColumnName); } ColumnMetadata columnMetadata = new ColumnMetadata( tableColumn.getField(), dataField.type(), dataField.description()); if (!DataTypeConvertUtils.convert(tableColumn.getDataType()).equals(dataField.type())) { TableChange.ModifyColumnType modifyColumnType = TableChange.modifyColumnType( columnMetadata, DataTypeConvertUtils.convert(tableColumn.getDataType())); tableChanges.add(modifyColumnType); } if (!Objects.equals(tableColumn.getComment(), dataField.description())) { TableChange.ModifyColumnComment modifyColumnComment = TableChange.modifyColumnComment(columnMetadata, tableColumn.getComment()); tableChanges.add(modifyColumnComment); } String key = FIELDS_PREFIX + "." + tableColumn.getField() + "." + DEFAULT_VALUE_SUFFIX; if (options.get(key) != null) { String defaultValue = options.get(key); if (!Objects.equals(tableColumn.getDefaultValue(), defaultValue)) { TableChange.SetOption setOption = TableChange.set( FIELDS_PREFIX + "." + tableColumn.getField() + "." + DEFAULT_VALUE_SUFFIX, tableColumn.getDefaultValue()); tableChanges.add(setOption); } } if (tableColumn.getSort().equals(0) && fieldIdIndexMap.get(tableColumn.getId()) != 0) { TableChange.ModifyColumnPosition modifyColumnPosition = TableChange.modifyColumnPosition( columnMetadata, TableChange.ColumnPosition.first()); tableChanges.add(modifyColumnPosition); } if (!tableColumn.getSort().equals(0) && !tableColumn.getSort().equals(fieldIdIndexMap.get(tableColumn.getId()))) { String referenceFieldName = tableColumnIndexMap.get(tableColumn.getSort() - 1); TableChange.ModifyColumnPosition modifyColumnPosition = TableChange.modifyColumnPosition( columnMetadata, TableChange.ColumnPosition.after(referenceFieldName)); tableChanges.add(modifyColumnPosition); } } /** * Builds a list of primary keys for the given table. * * @param tableDTO The TableInfo object representing the table. * @return A list of primary keys as strings. */ private List<String> buildPrimaryKeys(TableDTO tableDTO) { List<String> primaryKeys = new ArrayList<>(); List<TableColumn> tableColumns = tableDTO.getTableColumns(); if (!CollectionUtils.isEmpty(tableColumns)) { tableColumns.forEach( item -> { if (item.isPk()) { primaryKeys.add(item.getField()); } }); } return primaryKeys; } /** * Builds a list of ColumnMetadata objects for the given table. * * @param tableDTO The TableInfo object representing the table. * @return A list of ColumnMetadata objects. */ private List<ColumnMetadata> buildColumns(TableDTO tableDTO) { List<ColumnMetadata> columns = new ArrayList<>(); List<TableColumn> tableColumns = tableDTO.getTableColumns(); if (!CollectionUtils.isEmpty(tableColumns)) { tableColumns.forEach( item -> { ColumnMetadata columnMetadata = new ColumnMetadata( item.getField(), DataTypeConvertUtils.convert( new PaimonDataType( item.getDataType().getType(), item.getDataType().isNullable(), item.getDataType().getPrecision(), item.getDataType().getScale())), item.getComment() != null ? item.getComment() : null); columns.add(columnMetadata); }); } return columns; } /** * Retrieves the associated CatalogInfo object based on the given catalog name. * * @param catalogName The name of the catalog for which to retrieve the associated CatalogInfo. * @return The associated CatalogInfo object, or null if it doesn't exist. */ private CatalogInfo getCatalogInfo(String catalogName) { LambdaQueryWrapper<CatalogInfo> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(CatalogInfo::getCatalogName, catalogName); return catalogService.getOne(queryWrapper); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/UserServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/UserServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.server.data.dto.LoginDTO; import org.apache.paimon.web.server.data.dto.RoleWithUserDTO; import org.apache.paimon.web.server.data.dto.UserWithRolesDTO; import org.apache.paimon.web.server.data.enums.UserType; import org.apache.paimon.web.server.data.model.RoleMenu; import org.apache.paimon.web.server.data.model.SysMenu; import org.apache.paimon.web.server.data.model.SysRole; import org.apache.paimon.web.server.data.model.User; import org.apache.paimon.web.server.data.model.UserRole; import org.apache.paimon.web.server.data.result.exception.BaseException; import org.apache.paimon.web.server.data.result.exception.user.UserDisabledException; import org.apache.paimon.web.server.data.result.exception.user.UserNotExistsException; import org.apache.paimon.web.server.data.result.exception.user.UserPasswordNotMatchException; import org.apache.paimon.web.server.data.vo.UserInfoVO; import org.apache.paimon.web.server.data.vo.UserVO; import org.apache.paimon.web.server.mapper.UserMapper; import org.apache.paimon.web.server.mapper.UserRoleMapper; import org.apache.paimon.web.server.service.LdapService; import org.apache.paimon.web.server.service.RoleMenuService; import org.apache.paimon.web.server.service.SysMenuService; import org.apache.paimon.web.server.service.SysRoleService; import org.apache.paimon.web.server.service.TenantService; import org.apache.paimon.web.server.service.UserRoleService; import org.apache.paimon.web.server.service.UserService; import org.apache.paimon.web.server.util.StringUtils; import cn.dev33.satoken.secure.SaSecureUtil; import cn.dev33.satoken.session.SaSession; import cn.dev33.satoken.stp.StpUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.base.Preconditions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.DigestUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; /** UserServiceImpl. */ @Service public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService { @Autowired private LdapService ldapService; @Autowired private UserMapper userMapper; @Autowired private UserRoleService userRoleService; @Autowired private SysRoleService sysRoleService; @Autowired private RoleMenuService roleMenuService; @Autowired private SysMenuService sysMenuService; @Autowired private TenantService tenantService; @Autowired private UserRoleMapper userRoleMapper; @Override public UserVO getUserById(Integer id) { UserWithRolesDTO userWithRolesDTO = userMapper.selectUserWithRolesById(id); if (Objects.nonNull(userWithRolesDTO)) { return toVo(userWithRolesDTO); } return null; } @Override public List<UserVO> listUsers(IPage<User> page, User user) { return userMapper.listUsers(page, user).stream() .map(this::toVo) .collect(Collectors.toList()); } @Override public boolean checkUserNameUnique(User user) { int userId = user.getId() == null ? -1 : user.getId(); User info = this.lambdaQuery().eq(User::getUsername, user.getUsername()).one(); return info == null || info.getId() == userId; } /** * login by username and password. * * @param loginDTO login info * @return {@link String} */ @Override public UserInfoVO login(LoginDTO loginDTO) throws BaseException { String username = loginDTO.getUsername(); String password = loginDTO.getPassword(); User user = loginDTO.isLdapLogin() ? ldapLogin(username, password) : localLogin(username, password); if (!user.getEnabled()) { throw new UserDisabledException(); } // query user info UserInfoVO userInfoVo = getUserInfoVo(user); // todo: Currently do not bind tenants /*if (CollectionUtils.isEmpty(userInfoVo.getTenantList())) { throw new UserNotBindTenantException(); }*/ // Setting login user info to SaSession. StpUtil.login(user.getId(), loginDTO.isRememberMe()); userInfoVo.setPermissions(StpUtil.getPermissionList()); SaSession saSession = StpUtil.getSession(); saSession.set(user.getId().toString(), userInfoVo); return userInfoVo; } /** * get user info. include user, role, menu. tenant. * * @param user user * @return {@link UserInfoVO} */ private UserInfoVO getUserInfoVo(User user) { UserInfoVO userInfoVo = new UserInfoVO(); userInfoVo.setUser(user); userInfoVo.setSaTokenInfo(StpUtil.getTokenInfo()); // get user role list List<SysRole> sysRoles = new ArrayList<>(); List<UserRole> userRoleList = userRoleService.selectUserRoleListByUserId(user); // get role list userRoleList.forEach( userRole -> { sysRoles.add(sysRoleService.getById(userRole.getRoleId())); }); userInfoVo.setRoleList(sysRoles); // get menu list List<SysMenu> sysMenus = new ArrayList<>(); userRoleList.forEach( userRole -> { roleMenuService .list( new LambdaQueryWrapper<RoleMenu>() .eq(RoleMenu::getRoleId, userRole.getRoleId())) .forEach( roleMenu -> { sysMenus.add(sysMenuService.getById(roleMenu.getMenuId())); }); }); userInfoVo.setSysMenuList(sysMenus); userInfoVo.setCurrentTenant(tenantService.getById(1)); return userInfoVo; } private User localLogin(String username, String password) throws BaseException { User user = this.lambdaQuery() .eq(User::getUsername, username) .eq(User::getUserType, UserType.LOCAL.getCode()) .one(); if (user == null) { throw new UserNotExistsException(); } if (SaSecureUtil.md5(password).equals(user.getPassword())) { return user; } else { throw new UserPasswordNotMatchException(); } } private User ldapLogin(String username, String password) throws BaseException { Optional<User> authenticate = ldapService.authenticate(username, password); if (!authenticate.isPresent()) { throw new UserPasswordNotMatchException(); } User user = this.lambdaQuery() .eq(User::getUsername, username) .eq(User::getUserType, UserType.LDAP.getCode()) .one(); if (user == null) { user = authenticate.get(); this.save(user); // TODO assign default roles and tenants } return user; } /** * Query the list of assigned user roles. * * @param page the pagination information * @param roleWithUserDTO query params * @return user list */ @Override public List<User> selectAllocatedList( IPage<RoleWithUserDTO> page, RoleWithUserDTO roleWithUserDTO) { return userMapper.selectAllocatedList(page, roleWithUserDTO); } /** * Query the list of unassigned user roles. * * @param page the pagination information * @param roleWithUserDTO query params * @return user list */ @Override public List<User> selectUnallocatedList( IPage<RoleWithUserDTO> page, RoleWithUserDTO roleWithUserDTO) { return userMapper.selectUnallocatedList(page, roleWithUserDTO); } @Override @Transactional(rollbackFor = Exception.class) public int insertUser(User user) { user.setPassword(DigestUtils.md5DigestAsHex(user.getPassword().getBytes())); this.save(user); return insertUserRole(user); } @Override @Transactional(rollbackFor = Exception.class) public int updateUser(User user) { this.updateById(user); userRoleMapper.deleteUserRoleByUserId(user.getId()); return insertUserRole(user); } @Override @Transactional(rollbackFor = Exception.class) public int deleteUserByIds(Integer[] userIds) { userRoleMapper.deleteUserRole(userIds); return userMapper.deleteBatchIds(Arrays.asList(userIds)); } @Override public boolean changePassword(User user) { user.setPassword(DigestUtils.md5DigestAsHex(user.getPassword().getBytes())); return this.updateById(user); } @Override public boolean updateUserStatus(User user) { Preconditions.checkArgument(user != null && user.getId() != null); return this.lambdaUpdate() .set(User::getEnabled, user.getEnabled()) .eq(User::getId, user.getId()) .update(); } @Override public int allocateRole(User user) { return this.insertUserRole(user); } private int insertUserRole(User user) { int rows = 1; if (user.getRoleIds() != null && user.getRoleIds().length > 0) { List<UserRole> list = new ArrayList<>(); for (Integer roleId : user.getRoleIds()) { UserRole userRole = new UserRole(); userRole.setUserId(user.getId()); userRole.setRoleId(roleId); list.add(userRole); } if (!list.isEmpty()) { rows = userRoleMapper.batchUserRole(list); } } return rows; } private UserVO toVo(UserWithRolesDTO userWithRolesDTO) { return UserVO.builder() .id(userWithRolesDTO.getId()) .username(userWithRolesDTO.getUsername()) .nickname( StringUtils.isNotEmpty(userWithRolesDTO.getNickname()) ? userWithRolesDTO.getNickname() : "") .userType(userWithRolesDTO.getUserType()) .mobile( StringUtils.isNotEmpty(userWithRolesDTO.getMobile()) ? userWithRolesDTO.getMobile() : "") .email( StringUtils.isNotEmpty(userWithRolesDTO.getEmail()) ? userWithRolesDTO.getEmail() : "") .enabled(userWithRolesDTO.getEnabled()) .createTime(userWithRolesDTO.getCreateTime()) .updateTime(userWithRolesDTO.getUpdateTime()) .roles(userWithRolesDTO.getRoles()) .build(); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/CatalogServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/CatalogServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.api.catalog.PaimonServiceFactory; import org.apache.paimon.web.server.data.dto.CatalogDTO; import org.apache.paimon.web.server.data.enums.CatalogMode; import org.apache.paimon.web.server.data.model.CatalogInfo; import org.apache.paimon.web.server.mapper.CatalogMapper; import org.apache.paimon.web.server.service.CatalogService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import java.util.Objects; /** CatalogServiceImpl. */ @Service public class CatalogServiceImpl extends ServiceImpl<CatalogMapper, CatalogInfo> implements CatalogService { @Override public boolean checkCatalogNameUnique(CatalogDTO catalogDTO) { CatalogInfo info = this.lambdaQuery().eq(CatalogInfo::getCatalogName, catalogDTO.getName()).one(); return Objects.nonNull(info); } @Override public boolean createCatalog(CatalogDTO catalogDTO) { if (catalogDTO.getType().equalsIgnoreCase(CatalogMode.FILESYSTEM.getMode())) { PaimonServiceFactory.createFileSystemCatalogService( catalogDTO.getName(), catalogDTO.getWarehouse(), catalogDTO.getOptions()); } else if (catalogDTO.getType().equalsIgnoreCase(CatalogMode.HIVE.getMode())) { if (StringUtils.isNotBlank(catalogDTO.getHiveConfDir())) { PaimonServiceFactory.createHiveCatalogService( catalogDTO.getName(), catalogDTO.getWarehouse(), catalogDTO.getHiveUri(), catalogDTO.getHiveConfDir()); } else { PaimonServiceFactory.createHiveCatalogService( catalogDTO.getName(), catalogDTO.getWarehouse(), catalogDTO.getHiveUri(), null); } } CatalogInfo catalog = CatalogInfo.builder() .catalogName(catalogDTO.getName()) .catalogType(catalogDTO.getType()) .warehouse(catalogDTO.getWarehouse()) .options(catalogDTO.getOptions()) .isDelete(false) .build(); return this.save(catalog); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/SessionServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/SessionServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.engine.flink.sql.gateway.client.SqlGatewayClient; import org.apache.paimon.web.engine.flink.sql.gateway.model.SessionEntity; import org.apache.paimon.web.server.data.dto.SessionDTO; import org.apache.paimon.web.server.service.SessionService; import org.apache.paimon.web.server.service.UserService; import org.apache.paimon.web.server.service.UserSessionManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.UUID; /** The implementation of {@link SessionService}. */ @Service public class SessionServiceImpl implements SessionService { private static final Integer ACTIVE_STATUS = 1; private static final Integer INACTIVE_STATUS = 0; @Autowired private UserSessionManager sessionManager; @Autowired private UserService userService; @Override public void createSession(SessionDTO sessionDTO) { try { SqlGatewayClient client = new SqlGatewayClient(sessionDTO.getHost(), sessionDTO.getPort()); if (sessionDTO.getUid() != null) { String username = userService.getUserById(sessionDTO.getUid()).getUsername(); String sessionName = username + "_" + UUID.randomUUID(); if (getSession(sessionDTO.getUid(), sessionDTO.getClusterId()) == null || triggerSessionHeartbeat(sessionDTO) < 1) { SessionEntity sessionEntity = client.openSession(sessionName); sessionManager.addSession( sessionDTO.getUid() + "_" + sessionDTO.getClusterId(), sessionEntity); } } } catch (Exception e) { throw new RuntimeException("Failed to create session", e); } } @Override public void closeSession(SessionDTO sessionDTO) { try { SqlGatewayClient client = new SqlGatewayClient(sessionDTO.getHost(), sessionDTO.getPort()); if (sessionDTO.getUid() != null) { SessionEntity session = sessionManager.getSession( sessionDTO.getUid() + "_" + sessionDTO.getClusterId()); if (session != null) { client.closeSession(session.getSessionId()); sessionManager.removeSession( sessionDTO.getUid() + "_" + sessionDTO.getClusterId()); } } } catch (Exception e) { throw new RuntimeException("Failed to close session", e); } } @Override public int triggerSessionHeartbeat(SessionDTO sessionDTO) { try { if (sessionDTO.getUid() != null) { SqlGatewayClient client = new SqlGatewayClient(sessionDTO.getHost(), sessionDTO.getPort()); SessionEntity session = sessionManager.getSession( sessionDTO.getUid() + "_" + sessionDTO.getClusterId()); client.triggerSessionHeartbeat(session.getSessionId()); } } catch (Exception e) { return INACTIVE_STATUS; } return ACTIVE_STATUS; } @Override public SessionEntity getSession(Integer uid, Integer clusterId) { return sessionManager.getSession(uid + "_" + clusterId); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/StatementServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/StatementServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.server.data.model.StatementInfo; import org.apache.paimon.web.server.mapper.StatementMapper; import org.apache.paimon.web.server.service.StatementService; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** The implementation of {@link StatementService}. */ @Service public class StatementServiceImpl extends ServiceImpl<StatementMapper, StatementInfo> implements StatementService { @Autowired private StatementMapper statementMapper; @Override public boolean checkStatementNameUnique(StatementInfo statementInfo) { int statementId = statementInfo.getId() == null ? -1 : statementInfo.getId(); StatementInfo info = this.lambdaQuery() .eq(StatementInfo::getStatementName, statementInfo.getStatementName()) .one(); return info == null || info.getId() == statementId; } @Override public boolean saveStatement(StatementInfo statementInfo) { return this.save(statementInfo); } @Override public List<StatementInfo> listStatements(IPage<StatementInfo> page, StatementInfo statement) { return statementMapper.listStatements(page, statement); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/TenantServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/TenantServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.server.data.model.Tenant; import org.apache.paimon.web.server.mapper.TenantMapper; import org.apache.paimon.web.server.service.TenantService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** TenantServiceImpl. */ @Service public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> implements TenantService {}
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/HistoryServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/HistoryServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.server.data.model.History; import org.apache.paimon.web.server.mapper.HistoryMapper; import org.apache.paimon.web.server.service.HistoryService; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** The implementation of {@link HistoryService}. */ @Service public class HistoryServiceImpl extends ServiceImpl<HistoryMapper, History> implements HistoryService { @Autowired private HistoryMapper historyMapper; @Override public boolean saveHistory(History selectHistory) { return this.save(selectHistory); } @Override public List<History> listHistories(IPage<History> page, History history) { return historyMapper.listHistories(page, history); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/UserTenantServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/UserTenantServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.server.data.model.UserTenant; import org.apache.paimon.web.server.mapper.UserTenantMapper; import org.apache.paimon.web.server.service.UserTenantService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** UserTenantServiceImpl. */ @Service public class UserTenantServiceImpl extends ServiceImpl<UserTenantMapper, UserTenant> implements UserTenantService {}
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/ClusterServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/ClusterServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.engine.flink.common.status.HeartbeatStatus; import org.apache.paimon.web.engine.flink.sql.gateway.client.HeartbeatAction; import org.apache.paimon.web.engine.flink.sql.gateway.client.SessionClusterClient; import org.apache.paimon.web.engine.flink.sql.gateway.client.SqlGatewayClient; import org.apache.paimon.web.engine.flink.sql.gateway.model.HeartbeatEntity; import org.apache.paimon.web.gateway.enums.DeploymentMode; import org.apache.paimon.web.gateway.enums.EngineType; import org.apache.paimon.web.server.data.model.ClusterInfo; import org.apache.paimon.web.server.mapper.ClusterMapper; import org.apache.paimon.web.server.service.ClusterService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import java.time.Duration; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Arrays; import java.util.List; /** The implementation of {@link ClusterService}. */ @Service @Slf4j public class ClusterServiceImpl extends ServiceImpl<ClusterMapper, ClusterInfo> implements ClusterService { @Autowired private ClusterMapper clusterMapper; @Override public List<ClusterInfo> listUsers(IPage<ClusterInfo> page, ClusterInfo cluster) { return clusterMapper.listClusters(page, cluster); } @Override public boolean checkClusterNameUnique(ClusterInfo cluster) { int clusterId = cluster.getId() == null ? -1 : cluster.getId(); ClusterInfo info = this.lambdaQuery().eq(ClusterInfo::getClusterName, cluster.getClusterName()).one(); return info == null || info.getId() == clusterId; } @Override public int deleteClusterByIds(Integer[] clusterIds) { return clusterMapper.deleteBatchIds(Arrays.asList(clusterIds)); } @Override public boolean checkClusterHeartbeatStatus(ClusterInfo clusterInfo) { try { HeartbeatEntity clusterHeartbeatEntity = this.getHeartbeatActionFactory(clusterInfo).checkClusterHeartbeat(); return HeartbeatStatus.ACTIVE.name().equals(clusterHeartbeatEntity.getStatus()); } catch (Exception e) { throw new RuntimeException("Checking cluster heartbeat status error.", e); } } /** * Check the cluster status regularly. Execute every 10 seconds through CRON expression. Query * all enabled cluster information, and then check the heartbeat of each cluster one by one. For * engine types that do not support status check, record warning logs and skip. For supported * engine types, update the latest status information of the cluster. If an exception is * encountered during the check, record the error log. */ @Scheduled(cron = "0 * * * * ?") public void checkClusterHeartbeatStatus() { QueryWrapper<ClusterInfo> queryWrapper = new QueryWrapper<ClusterInfo>().eq("enabled", true); for (ClusterInfo clusterInfo : clusterMapper.selectList(queryWrapper)) { if (EngineType.SPARK.name().equals(clusterInfo.getType().toUpperCase())) { log.warn( "Current engine type: {} doesn't support checking Cluster status.", clusterInfo.getType()); continue; } try { HeartbeatEntity heartbeat = this.getHeartbeatActionFactory(clusterInfo).checkClusterHeartbeat(); this.buildClusterInfo(clusterInfo, heartbeat); clusterMapper.updateById(clusterInfo); } catch (Exception e) { log.error( "Failed to check Cluster: {} status by executor: {}", clusterInfo.getClusterName(), e.getMessage(), e); } } } /** * Get the corresponding cluster operation instance based on the cluster information. * * <p>This method determines which type of cluster operation instance to create based on the * deployment mode specified in the cluster information. Supported deployment modes include * {@link DeploymentMode}. If the specified engine type is not supported, an * UnsupportedOperationException will be thrown. * * @param clusterInfo Cluster information, including type, host, and port. * @return Returns a cluster operation instance for interacting with a specific type of cluster. * @throws Exception If the specified engine type is not supported, an exception will be thrown. */ public HeartbeatAction getHeartbeatActionFactory(ClusterInfo clusterInfo) throws Exception { DeploymentMode deploymentMode = DeploymentMode.fromName(clusterInfo.getDeploymentMode()); switch (deploymentMode) { case YARN_SESSION: return new SessionClusterClient(clusterInfo.getHost(), clusterInfo.getPort()); case FLINK_SQL_GATEWAY: return new SqlGatewayClient(clusterInfo.getHost(), clusterInfo.getPort()); default: throw new UnsupportedOperationException( deploymentMode + " deployment mode is not currently supported."); } } public void buildClusterInfo(ClusterInfo clusterInfo, HeartbeatEntity result) { clusterInfo.setUpdateTime(LocalDateTime.now()); String active = HeartbeatStatus.ACTIVE.name(); if (active.equals(result.getStatus())) { LocalDateTime dateTime = LocalDateTime.ofInstant( Instant.ofEpochMilli(result.getLastHeartbeat()), ZoneId.systemDefault()); clusterInfo.setHeartbeatStatus(active); clusterInfo.setLastHeartbeat(dateTime); } // If the status is not active, and the last heartbeat time is greater than 5 minutes, the // cluster status is set to dead. if (!clusterInfo.getHeartbeatStatus().equals(active)) { Duration duration = Duration.between(clusterInfo.getLastHeartbeat(), LocalDateTime.now()); long differenceInMinutes = Math.abs(duration.toMinutes()); if (differenceInMinutes > 5) { clusterInfo.setHeartbeatStatus(HeartbeatStatus.DEAD.name()); } else { clusterInfo.setHeartbeatStatus(result.getStatus()); } } else { clusterInfo.setHeartbeatStatus(result.getStatus()); } } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/JobServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/JobServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.engine.flink.common.executor.Executor; import org.apache.paimon.web.engine.flink.common.executor.ExecutorFactory; import org.apache.paimon.web.engine.flink.common.result.ExecutionResult; import org.apache.paimon.web.engine.flink.common.result.FetchResultParams; import org.apache.paimon.web.engine.flink.common.status.JobStatus; import org.apache.paimon.web.engine.flink.sql.gateway.model.SessionEntity; import org.apache.paimon.web.gateway.config.ExecutionConfig; import org.apache.paimon.web.gateway.enums.DeploymentMode; import org.apache.paimon.web.gateway.enums.EngineType; import org.apache.paimon.web.gateway.provider.ExecutorFactoryProvider; import org.apache.paimon.web.server.context.LogContextHolder; import org.apache.paimon.web.server.context.logtool.LogEntity; import org.apache.paimon.web.server.context.logtool.LogReadPool; import org.apache.paimon.web.server.context.logtool.LogType; import org.apache.paimon.web.server.data.dto.JobSubmitDTO; import org.apache.paimon.web.server.data.dto.ResultFetchDTO; import org.apache.paimon.web.server.data.dto.SessionDTO; import org.apache.paimon.web.server.data.dto.StopJobDTO; import org.apache.paimon.web.server.data.model.ClusterInfo; import org.apache.paimon.web.server.data.model.History; import org.apache.paimon.web.server.data.model.JobInfo; import org.apache.paimon.web.server.data.vo.JobStatisticsVO; import org.apache.paimon.web.server.data.vo.JobVO; import org.apache.paimon.web.server.data.vo.ResultDataVO; import org.apache.paimon.web.server.mapper.JobMapper; import org.apache.paimon.web.server.service.ClusterService; import org.apache.paimon.web.server.service.HistoryService; import org.apache.paimon.web.server.service.JobExecutorService; import org.apache.paimon.web.server.service.JobService; import org.apache.paimon.web.server.service.SessionService; import org.apache.paimon.web.server.service.UserSessionManager; import org.apache.paimon.web.server.util.LocalDateTimeUtil; import org.apache.paimon.web.server.util.LogUtil; import cn.dev33.satoken.stp.StpUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import static cn.dev33.satoken.stp.StpUtil.getLoginIdAsString; /** The implementation of {@link JobService}. */ @Service @Slf4j public class JobServiceImpl extends ServiceImpl<JobMapper, JobInfo> implements JobService { private static final String STREAMING_MODE = "Streaming"; private static final String BATCH_MODE = "Batch"; private static final String SHOW_JOBS_STATEMENT = "SHOW JOBS"; @Autowired private JobMapper jobMapper; @Autowired private UserSessionManager sessionManager; @Autowired private SessionService sessionService; @Autowired private ClusterService clusterService; @Autowired private JobExecutorService jobExecutorService; @Autowired private HistoryService historyService; @Autowired private SimpMessagingTemplate messagingTemplate; @Override public JobVO submitJob(JobSubmitDTO jobSubmitDTO) { String pipelineName = getPipelineName(jobSubmitDTO.getStatements()); if (StringUtils.isNotBlank(pipelineName)) { jobSubmitDTO.setJobName(pipelineName); } else { pipelineName = jobSubmitDTO.getJobName(); jobSubmitDTO.setStatements( addPipelineNameStatement(pipelineName, jobSubmitDTO.getStatements())); } if (!StpUtil.isLogin()) { throw new IllegalStateException("User must be logged in to access this resource"); } String executeMode = jobSubmitDTO.isStreaming() ? STREAMING_MODE.toLowerCase() : BATCH_MODE.toLowerCase(); jobSubmitDTO.setStatements( addExecutionModeStatement(executeMode, jobSubmitDTO.getStatements())); LogEntity logWriter = LogContextHolder.registerProcess( LogEntity.init(LogType.get(executeMode), getLoginIdAsString())); logWriter.info(String.format("Initializing %s job config...", jobSubmitDTO.getTaskType())); Executor executor = this.getExecutor(jobSubmitDTO.getClusterId(), jobSubmitDTO.getTaskType()); if (executor == null) { logWriter.error("No executor available for the job submission."); throw new RuntimeException("No executor available for the job submission."); } try { logWriter.start(); logWriter.info( String.format( "Starting to submit %s %s job...", jobSubmitDTO.getTaskType(), executeMode)); ExecutionResult executionResult = executor.executeSql(jobSubmitDTO.getStatements(), jobSubmitDTO.getMaxRows()); if (StringUtils.isNotBlank(executionResult.getJobId())) { JobInfo jobInfo = buildJobInfo(executionResult, jobSubmitDTO); this.save(jobInfo); } logWriter.finish( String.format( "Execution successful [Job ID: %s].", executionResult.getJobId())); messagingTemplate.convertAndSend( "/topic/job", buildJobVO(executionResult, jobSubmitDTO)); historyService.saveHistory( History.builder() .name(LocalDateTimeUtil.getFormattedDateTime(LocalDateTime.now())) .taskType(jobSubmitDTO.getTaskType()) .isStreaming(jobSubmitDTO.isStreaming()) .uid(getCurrentUserId()) .clusterId(Integer.valueOf(jobSubmitDTO.getClusterId())) .statements(jobSubmitDTO.getStatements()) .build()); return buildJobVO(executionResult, jobSubmitDTO); } catch (Exception e) { logWriter.error( LogUtil.getError(String.format("Error executing job: %s", e.getMessage()), e)); throw new RuntimeException(String.format("Error executing job: %s", e.getMessage()), e); } } @Override public ResultDataVO fetchResult(ResultFetchDTO resultFetchDTO) { long token = resultFetchDTO.getToken() + 1; try { Executor executor = this.getExecutor(resultFetchDTO.getClusterId(), resultFetchDTO.getTaskType()); if (executor == null) { throw new RuntimeException("No executor available for result fetching."); } FetchResultParams params = FetchResultParams.builder() .sessionId(resultFetchDTO.getSessionId()) .submitId(resultFetchDTO.getSubmitId()) .token(token) .build(); ExecutionResult executionResult = executor.fetchResults(params); ResultDataVO.ResultDataVOBuilder builder = ResultDataVO.builder() .resultData(executionResult.getData()) .rows(executionResult.getData().size()) .token(token); if (!executionResult.getData().isEmpty()) { builder.columns(executionResult.getData().get(0).entrySet().size()); } else { builder.columns(0); } return builder.build(); } catch (Exception e) { throw new RuntimeException("Error fetching result:" + e.getMessage(), e); } } @Override public List<JobVO> listJobs() { List<JobInfo> jobInfos = this.list(); return jobInfos.stream().map(this::convertJobInfoToJobVO).collect(Collectors.toList()); } @Override public List<JobVO> listJobsByPage(int current, int size) { QueryWrapper<JobInfo> queryWrapper = new QueryWrapper<>(); queryWrapper.orderByDesc("create_time"); Page<JobInfo> page = new Page<>(current, size); IPage<JobInfo> jobInfoIPage = jobMapper.selectPage(page, queryWrapper); List<JobInfo> records = jobInfoIPage.getRecords(); return records.stream().map(this::convertJobInfoToJobVO).collect(Collectors.toList()); } @Override public JobInfo getJobById(String id) { QueryWrapper<JobInfo> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("job_id", id); return jobMapper.selectOne(queryWrapper); } @Override public JobStatisticsVO getJobStatistics() { List<JobInfo> jobInfos = this.list(); long totalNum = jobInfos.size(); long runningNum = jobInfos.stream() .filter(job -> JobStatus.RUNNING.getValue().equals(job.getStatus())) .count(); long finishedNum = jobInfos.stream() .filter(job -> JobStatus.FINISHED.getValue().equals(job.getStatus())) .count(); long canceledNum = jobInfos.stream() .filter(job -> JobStatus.CANCELED.getValue().equals(job.getStatus())) .count(); long failedNum = jobInfos.stream() .filter(job -> JobStatus.FAILED.getValue().equals(job.getStatus())) .count(); return JobStatisticsVO.builder() .totalNum(totalNum) .runningNum(runningNum) .finishedNum(finishedNum) .canceledNum(canceledNum) .failedNum(failedNum) .build(); } @Override public void stop(StopJobDTO stopJobDTO) { LogEntity logWriter = LogContextHolder.registerProcess( LogEntity.init(LogType.UNKNOWN, getLoginIdAsString())); try { logWriter.info(String.format("Starting to stop %s job...", stopJobDTO.getTaskType())); Executor executor = getExecutor(stopJobDTO.getClusterId(), stopJobDTO.getTaskType()); if (executor == null) { logWriter.error("No executor available for job stopping."); throw new RuntimeException("No executor available for job stopping."); } logWriter.start(); executor.stop(stopJobDTO.getJobId(), stopJobDTO.isWithSavepoint()); boolean updateStatus = updateJobStatusAndEndTime( stopJobDTO.getJobId(), JobStatus.CANCELED.getValue(), LocalDateTime.now()); if (!updateStatus) { logWriter.error( String.format( "Failed to update job status in the database for jobId: %s", stopJobDTO.getJobId())); log.error( "Failed to update job status in the database for jobId: {}", stopJobDTO.getJobId()); } else { logWriter.info( String.format( "Successfully stopped job [Job ID: %s].", stopJobDTO.getJobId())); } logWriter.finish(); } catch (Exception e) { logWriter.error(String.format("Error stopping job: %s", e.getMessage())); throw new RuntimeException("Error stopping job:" + e.getMessage(), e); } } @Override public void refreshJobStatus(String taskType) { if (!StpUtil.isLogin()) { throw new IllegalStateException("User must be logged in to access this resource"); } int userId = StpUtil.getLoginIdAsInt(); if (taskType.equals("Flink")) { QueryWrapper<ClusterInfo> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("deployment_mode", DeploymentMode.FLINK_SQL_GATEWAY.getType()); List<ClusterInfo> clusters = clusterService.list(queryWrapper); for (ClusterInfo cluster : clusters) { try { SessionEntity session = sessionManager.getSession(userId + "_" + cluster.getId()); if (session == null) { return; } Executor executor = jobExecutorService.getExecutor(session.getSessionId()); if (executor == null) { return; } ExecutionResult executionResult = executor.executeSql(SHOW_JOBS_STATEMENT, 0); List<Map<String, Object>> jobsData = executionResult.getData(); for (Map<String, Object> jobData : jobsData) { String jobId = (String) jobData.get("job id"); String jobStatus = (String) jobData.get("status"); String utcTimeString = (String) jobData.get("start time"); LocalDateTime startTime = LocalDateTimeUtil.convertUtcStringToLocalDateTime(utcTimeString); JobInfo job = getJobById(jobId); if (job != null && job.getUid().equals(userId)) { String currentStatus = job.getStatus(); if (!jobStatus.equals(currentStatus)) { job.setStatus(jobStatus); messagingTemplate.convertAndSend("/topic/jobStatus", job); if (JobStatus.RUNNING.getValue().equals(jobStatus)) { updateJobStatusAndStartTime(jobId, jobStatus, startTime); } else if (JobStatus.FINISHED.getValue().equals(jobStatus) || JobStatus.CANCELED.getValue().equals(jobStatus) || JobStatus.FAILED.getValue().equals(jobStatus)) { LocalDateTime endTime = job.getEndTime() == null ? LocalDateTime.now() : job.getEndTime(); updateJobStatusAndEndTime(jobId, jobStatus, endTime); } else { JobInfo jobInfo = new JobInfo(); jobInfo.setId(job.getId()); jobInfo.setStatus(jobStatus); this.updateById(jobInfo); } } } } } catch (Exception e) { log.error("Exception with refreshing job status.", e); } } } } @Override public String getLogsByUserId(String userId) { if (LogReadPool.getInstance().exist(userId)) { return LogReadPool.getInstance().get(userId).toString(); } else { return ""; } } @Override public String clearLog(String userId) { if (LogReadPool.getInstance().exist(userId)) { LogReadPool.clear(userId); return LogReadPool.getInstance().get(userId).toString(); } else { return ""; } } @Async @Scheduled(initialDelay = 60000, fixedDelay = 30000) public void initializeExecutorsIfNeeded() { List<SessionEntity> sessions = sessionManager.getAllSessions(); for (SessionEntity session : sessions) { try { Executor executor = jobExecutorService.getExecutor(session.getSessionId()); if (executor == null) { ExecutionConfig config = ExecutionConfig.builder().sessionEntity(session).build(); EngineType engineType = EngineType.fromName("FLINK"); ExecutorFactoryProvider provider = new ExecutorFactoryProvider(config); ExecutorFactory executorFactory = provider.getExecutorFactory(engineType); executor = executorFactory.createExecutor(); jobExecutorService.addExecutor(session.getSessionId(), executor); } } catch (Exception e) { throw new RuntimeException( "Failed to create executor for session ID:" + session.getSessionId(), e); } } } private boolean updateJobStatusAndEndTime( String jobId, String newStatus, LocalDateTime endTime) { JobInfo jobInfo = new JobInfo(); jobInfo.setStatus(newStatus); jobInfo.setEndTime(endTime); return this.update(jobInfo, new QueryWrapper<JobInfo>().eq("job_id", jobId)); } private boolean updateJobStatusAndStartTime( String jobId, String newStatus, LocalDateTime startTime) { JobInfo jobInfo = new JobInfo(); jobInfo.setStatus(newStatus); jobInfo.setStartTime(startTime); return this.update(jobInfo, new QueryWrapper<JobInfo>().eq("job_id", jobId)); } private JobVO convertJobInfoToJobVO(JobInfo jobInfo) { JobVO.JobVOBuilder builder = JobVO.builder() .jobId(jobInfo.getJobId()) .jobName(jobInfo.getJobName()) .type(jobInfo.getType()) .executeMode(jobInfo.getExecuteMode()) .clusterId(jobInfo.getClusterId()); if (jobInfo.getStartTime() != null) { builder.startTime(jobInfo.getStartTime()); } if (jobInfo.getEndTime() != null) { builder.endTime(jobInfo.getEndTime()); } if (StringUtils.isNotBlank(jobInfo.getStatus())) { builder.status(jobInfo.getStatus()); } return builder.build(); } private JobInfo buildJobInfo(ExecutionResult executionResult, JobSubmitDTO jobSubmitDTO) { JobInfo.JobInfoBuilder builder = JobInfo.builder() .jobId(executionResult.getJobId()) .type(jobSubmitDTO.getTaskType()) .statements(jobSubmitDTO.getStatements()) .status(JobStatus.CREATED.getValue()) .fileName(jobSubmitDTO.getFileName()) .clusterId(jobSubmitDTO.getClusterId()); String jobName = jobSubmitDTO.getJobName() != null ? jobSubmitDTO.getJobName() : ""; builder.jobName(jobName); if (StringUtils.isNotBlank(executionResult.getStatus())) { builder.status(executionResult.getStatus()); } Map<String, String> config = MapUtils.isNotEmpty(jobSubmitDTO.getConfig()) ? jobSubmitDTO.getConfig() : new HashMap<>(); ObjectMapper objectMapper = new ObjectMapper(); String jsonConfig; try { jsonConfig = objectMapper.writeValueAsString(config); } catch (Exception e) { jsonConfig = "{}"; } builder.config(jsonConfig); String executeMode = jobSubmitDTO.isStreaming() ? STREAMING_MODE : BATCH_MODE; builder.executeMode(executeMode); if (StpUtil.isLogin()) { builder.uid(StpUtil.getLoginIdAsInt()); } return builder.build(); } private JobVO buildJobVO(ExecutionResult executionResult, JobSubmitDTO jobSubmitDTO) { JobVO.JobVOBuilder builder = JobVO.builder() .type(jobSubmitDTO.getTaskType()) .shouldFetchResult(executionResult.shouldFetchResult()) .submitId(executionResult.getSubmitId()) .resultData(executionResult.getData()) .clusterId(jobSubmitDTO.getClusterId()) .jobName(jobSubmitDTO.getJobName()) .fileName(jobSubmitDTO.getFileName()) .token(0L); String executeMode = jobSubmitDTO.isStreaming() ? STREAMING_MODE : BATCH_MODE; builder.executeMode(executeMode); if (StringUtils.isNotBlank(executionResult.getJobId())) { builder.jobId(executionResult.getJobId()); } if (StringUtils.isNotBlank(executionResult.getStatus())) { builder.status(executionResult.getStatus()); } if (StpUtil.isLogin()) { builder.uid(StpUtil.getLoginIdAsInt()) .sessionId( sessionManager .getSession( StpUtil.getLoginIdAsInt() + "_" + jobSubmitDTO.getClusterId()) .getSessionId()); } return builder.build(); } private String getPipelineName(String statements) { String regex = "set\\s+'pipeline\\.name'\\s*=\\s*'([^']+)'"; Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(statements); if (matcher.find()) { return matcher.group(1); } return null; } private String addPipelineNameStatement(String pipelineName, String statements) { return "SET 'pipeline.name' = '" + pipelineName + "';\n" + statements; } private String addExecutionModeStatement(String executionMode, String statements) { return "SET 'execution.runtime-mode' = '" + executionMode + "';\n" + statements; } private boolean shouldCreateSession(String clusterId) { if (StpUtil.isLogin()) { SessionEntity session = sessionManager.getSession(StpUtil.getLoginIdAsInt() + "_" + clusterId); if (session != null) { SessionDTO sessionDTO = new SessionDTO(); sessionDTO.setHost(session.getHost()); sessionDTO.setPort(session.getPort()); sessionDTO.setUid(StpUtil.getLoginIdAsInt()); sessionDTO.setClusterId(Integer.valueOf(clusterId)); return sessionService.triggerSessionHeartbeat(sessionDTO) <= 0; } } return true; } private Executor getExecutor(String clusterId, String taskType) { try { if (!StpUtil.isLogin()) { throw new IllegalStateException("User must be logged in to access this resource"); } if (shouldCreateSession(clusterId)) { ClusterInfo clusterInfo = clusterService.getById(clusterId); if (clusterInfo == null) { throw new IllegalStateException("No cluster found with ID: " + clusterId); } SessionDTO sessionDTO = new SessionDTO(); sessionDTO.setHost(clusterInfo.getHost()); sessionDTO.setPort(clusterInfo.getPort()); sessionDTO.setUid(StpUtil.getLoginIdAsInt()); sessionDTO.setClusterId(Integer.valueOf(clusterId)); sessionService.createSession(sessionDTO); } SessionEntity session = sessionManager.getSession(StpUtil.getLoginIdAsInt() + "_" + clusterId); if (jobExecutorService.getExecutor(session.getSessionId()) == null) { ExecutionConfig config = ExecutionConfig.builder().sessionEntity(session).build(); EngineType engineType = EngineType.fromName(taskType.toUpperCase()); ExecutorFactoryProvider provider = new ExecutorFactoryProvider(config); ExecutorFactory executorFactory = provider.getExecutorFactory(engineType); Executor executor = executorFactory.createExecutor(); jobExecutorService.addExecutor(session.getSessionId(), executor); } return jobExecutorService.getExecutor(session.getSessionId()); } catch (Exception e) { log.error("Failed to create executor: {}", e.getMessage(), e); } return null; } private int getCurrentUserId() { if (!StpUtil.isLogin()) { throw new IllegalStateException("User must be logged in to access this resource."); } return StpUtil.getLoginIdAsInt(); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/CdcJobDefinitionServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/CdcJobDefinitionServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.api.action.context.ActionContext; import org.apache.paimon.web.api.action.context.factory.ActionContextFactoryServiceLoadUtil; import org.apache.paimon.web.api.action.context.factory.FlinkCdcActionContextFactory; import org.apache.paimon.web.api.action.context.options.FlinkCdcOptions; import org.apache.paimon.web.api.action.service.ActionService; import org.apache.paimon.web.api.action.service.FlinkCdcActionService; import org.apache.paimon.web.api.catalog.PaimonServiceFactory; import org.apache.paimon.web.api.enums.FlinkCdcDataSourceType; import org.apache.paimon.web.api.enums.FlinkCdcSyncType; import org.apache.paimon.web.common.util.JSONUtils; import org.apache.paimon.web.server.data.dto.CdcJobDefinitionDTO; import org.apache.paimon.web.server.data.dto.CdcJobSubmitDTO; import org.apache.paimon.web.server.data.model.CatalogInfo; import org.apache.paimon.web.server.data.model.CdcJobDefinition; import org.apache.paimon.web.server.data.model.ClusterInfo; import org.apache.paimon.web.server.data.model.cdc.CdcGraph; import org.apache.paimon.web.server.data.model.cdc.CdcNode; import org.apache.paimon.web.server.data.result.PageR; import org.apache.paimon.web.server.data.result.R; import org.apache.paimon.web.server.data.result.enums.Status; import org.apache.paimon.web.server.data.vo.UserInfoVO; import org.apache.paimon.web.server.mapper.CdcJobDefinitionMapper; import org.apache.paimon.web.server.service.CatalogService; import org.apache.paimon.web.server.service.CdcJobDefinitionService; import org.apache.paimon.web.server.service.ClusterService; import org.apache.paimon.web.server.util.StringUtils; import cn.dev33.satoken.stp.StpUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.base.Preconditions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; /** CdcJobDefinitionServiceImpl. */ @Service public class CdcJobDefinitionServiceImpl extends ServiceImpl<CdcJobDefinitionMapper, CdcJobDefinition> implements CdcJobDefinitionService { @Autowired private CatalogService catalogService; @Autowired private ClusterService clusterService; @Override public R<Void> create(CdcJobDefinitionDTO cdcJobDefinitionDTO) { String name = cdcJobDefinitionDTO.getName(); QueryWrapper<CdcJobDefinition> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("name", name); if (baseMapper.exists(queryWrapper)) { return R.failed(Status.CDC_JOB_EXIST_ERROR); } String jobCreateUser; if (StringUtils.isBlank(cdcJobDefinitionDTO.getCreateUser())) { int loginId = StpUtil.getLoginIdAsInt(); UserInfoVO userInfoVo = (UserInfoVO) StpUtil.getSession().get(Integer.toString(loginId)); jobCreateUser = userInfoVo.getUser().getUsername(); } else { jobCreateUser = cdcJobDefinitionDTO.getCreateUser(); } CdcJobDefinition cdcJobDefinition = CdcJobDefinition.builder() .name(cdcJobDefinitionDTO.getName()) .config(cdcJobDefinitionDTO.getConfig()) .cdcType(cdcJobDefinitionDTO.getCdcType()) .createUser(jobCreateUser) .description(cdcJobDefinitionDTO.getDescription()) .build(); baseMapper.insert(cdcJobDefinition); return R.succeed(); } @Override public PageR<CdcJobDefinition> listAll( String name, boolean withConfig, long currentPage, long pageSize) { Page<CdcJobDefinition> page = new Page<>(currentPage, pageSize); QueryWrapper<CdcJobDefinition> queryWrapper = new QueryWrapper<>(); queryWrapper.select( "id", "name", "cdc_type", "create_user", "description", "update_time", "create_time"); if (!withConfig) { queryWrapper.select( "name", "id", "description", "cdc_type", "create_user", "update_time", "create_time"); } queryWrapper.like(StringUtils.isNotBlank(name), "name", name); Page<CdcJobDefinition> resPage = baseMapper.selectPage(page, queryWrapper); return new PageR<>(resPage.getTotal(), true, resPage.getRecords()); } @Override public R<Void> update(CdcJobDefinitionDTO cdcJobDefinitionDTO) { QueryWrapper<CdcJobDefinition> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("id", cdcJobDefinitionDTO.getId()); if (!baseMapper.exists(queryWrapper)) { return R.failed(Status.CDC_JOB_NO_EXIST_ERROR); } CdcJobDefinition cdcJobDefinition = CdcJobDefinition.builder() .name(cdcJobDefinitionDTO.getName()) .config(cdcJobDefinitionDTO.getConfig()) .cdcType(cdcJobDefinitionDTO.getCdcType()) .createUser(cdcJobDefinitionDTO.getCreateUser()) .description(cdcJobDefinitionDTO.getDescription()) .build(); cdcJobDefinition.setId(cdcJobDefinitionDTO.getId()); baseMapper.updateById(cdcJobDefinition); return R.succeed(); } @Override public R<Void> submit(Integer id, CdcJobSubmitDTO cdcJobSubmitDTO) { CdcJobDefinition cdcJobDefinition = baseMapper.selectById(id); String config = cdcJobDefinition.getConfig(); FlinkCdcSyncType flinkCdcSyncType = FlinkCdcSyncType.valueOf(cdcJobDefinition.getCdcType()); ActionService actionService = new FlinkCdcActionService(); CdcGraph cdcGraph = CdcGraph.fromCdcGraphJsonString(config); FlinkCdcActionContextFactory factory = ActionContextFactoryServiceLoadUtil.getFlinkCdcActionContextFactory( cdcGraph.getSource().getType(), cdcGraph.getTarget().getType(), flinkCdcSyncType); ObjectNode actionConfigs = JSONUtils.createObjectNode(); String clusterId = cdcJobSubmitDTO.getClusterId(); ClusterInfo clusterInfo = clusterService.getById(clusterId); actionConfigs.put( FlinkCdcOptions.SESSION_URL, String.format("%s:%s", clusterInfo.getHost(), clusterInfo.getPort())); handleCdcGraphNodeData(actionConfigs, cdcGraph.getSource(), flinkCdcSyncType); handleCdcGraphNodeData(actionConfigs, cdcGraph.getTarget(), flinkCdcSyncType); ActionContext actionContext = factory.getActionContext(actionConfigs); try { actionService.execute(actionContext); } catch (Exception e) { throw new RuntimeException(e); } return R.succeed(); } private void handleCdcGraphNodeData( ObjectNode actionConfigs, CdcNode node, FlinkCdcSyncType cdcSyncType) { FlinkCdcDataSourceType cdcDataSourceType = FlinkCdcDataSourceType.of(node.getType()); Preconditions.checkNotNull( cdcDataSourceType, String.format("CDC datasource type should not be null.", node.getType())); switch (cdcDataSourceType) { case PAIMON: handlePaimonNodeData(actionConfigs, node.getData(), cdcSyncType); break; case MYSQL: handleMysqlNodeData(actionConfigs, node.getData(), cdcSyncType); break; case POSTGRESQL: handlePostgresNodeData(actionConfigs, node.getData()); break; } } private List<String> getOtherConfigs(ObjectNode node) { String otherConfigs = JSONUtils.getString(node, "other_configs"); List<String> configList; if (StringUtils.isBlank(otherConfigs)) { configList = new ArrayList<>(); } else { configList = new ArrayList<>(Arrays.asList(otherConfigs.split(";"))); } return configList; } private void handlePostgresNodeData(ObjectNode actionConfigs, ObjectNode postgresData) { List<String> postgresConfList = getOtherConfigs(postgresData); postgresConfList.add( buildKeyValueString("hostname", JSONUtils.getString(postgresData, "host"))); postgresConfList.add( buildKeyValueString("port", JSONUtils.getString(postgresData, "port"))); postgresConfList.add( buildKeyValueString("username", JSONUtils.getString(postgresData, "username"))); postgresConfList.add( buildKeyValueString("password", JSONUtils.getString(postgresData, "password"))); postgresConfList.add( buildKeyValueString( "database-name", JSONUtils.getString(postgresData, "database"))); postgresConfList.add( buildKeyValueString( "schema-name", JSONUtils.getString(postgresData, "schema_name"))); postgresConfList.add( buildKeyValueString("table-name", JSONUtils.getString(postgresData, "table_name"))); postgresConfList.add( buildKeyValueString("slot.name", JSONUtils.getString(postgresData, "slot_name"))); actionConfigs.putPOJO(FlinkCdcOptions.POSTGRES_CONF, postgresConfList); } private void handleMysqlNodeData( ObjectNode actionConfigs, ObjectNode mysqlData, FlinkCdcSyncType cdcSyncType) { List<String> mysqlConfList = getOtherConfigs(actionConfigs); mysqlConfList.add(buildKeyValueString("hostname", JSONUtils.getString(mysqlData, "host"))); mysqlConfList.add( buildKeyValueString("username", JSONUtils.getString(mysqlData, "username"))); mysqlConfList.add(buildKeyValueString("port", JSONUtils.getString(mysqlData, "port"))); mysqlConfList.add( buildKeyValueString("database-name", JSONUtils.getString(mysqlData, "database"))); if (cdcSyncType == FlinkCdcSyncType.SINGLE_TABLE_SYNC) { mysqlConfList.add( buildKeyValueString( "table-name", JSONUtils.getString(mysqlData, "table_name"))); } mysqlConfList.add( buildKeyValueString("password", JSONUtils.getString(mysqlData, "password"))); actionConfigs.putPOJO(FlinkCdcOptions.MYSQL_CONF, mysqlConfList); } private void handlePaimonNodeData( ObjectNode actionConfigs, ObjectNode paimonData, FlinkCdcSyncType cdcSyncType) { Integer catalog = JSONUtils.getInteger(paimonData, "catalog"); CatalogInfo catalogInfo = catalogService.getById(catalog); actionConfigs.put(FlinkCdcOptions.WAREHOUSE, catalogInfo.getWarehouse()); if (cdcSyncType == FlinkCdcSyncType.SINGLE_TABLE_SYNC) { actionConfigs.put(FlinkCdcOptions.TABLE, JSONUtils.getString(paimonData, "table_name")); } actionConfigs.put(FlinkCdcOptions.DATABASE, JSONUtils.getString(paimonData, "database")); actionConfigs.put( FlinkCdcOptions.PRIMARY_KEYS, JSONUtils.getString(paimonData, "primary_key")); String otherConfigs = JSONUtils.getString(paimonData, "other_configs2"); if (StringUtils.isBlank(otherConfigs)) { actionConfigs.putPOJO(FlinkCdcOptions.TABLE_CONF, new ArrayList<>()); } else { actionConfigs.putPOJO( FlinkCdcOptions.TABLE_CONF, Arrays.asList(otherConfigs.split(";"))); } List<String> catalogConfList = new ArrayList<>(); Map<String, String> options = catalogInfo.getOptions(); PaimonServiceFactory.convertToPaimonOptions(options) .toMap() .forEach( (k, v) -> { catalogConfList.add(buildKeyValueString(k, v)); }); actionConfigs.putPOJO(FlinkCdcOptions.CATALOG_CONF, catalogConfList); } private String buildKeyValueString(String key, String value) { return key + "=" + value; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/SysMenuServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/SysMenuServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.server.constant.Constants; import org.apache.paimon.web.server.data.enums.MenuType; import org.apache.paimon.web.server.data.model.SysMenu; import org.apache.paimon.web.server.data.model.User; import org.apache.paimon.web.server.data.tree.TreeSelect; import org.apache.paimon.web.server.data.vo.MetaVO; import org.apache.paimon.web.server.data.vo.RouterVO; import org.apache.paimon.web.server.mapper.RoleMenuMapper; import org.apache.paimon.web.server.mapper.SysMenuMapper; import org.apache.paimon.web.server.mapper.SysRoleMapper; import org.apache.paimon.web.server.service.SysMenuService; import org.apache.paimon.web.server.util.StringUtils; import cn.dev33.satoken.stp.StpUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Set; import java.util.stream.Collectors; /** Menu service. */ @Service public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements SysMenuService { public static final String PREMISSION_STRING = "perms[\"{0}\"]"; @Autowired private SysMenuMapper menuMapper; @Autowired private SysRoleMapper roleMapper; @Autowired private RoleMenuMapper roleMenuMapper; /** * Query menu list by user. * * @return menu list */ @Override public List<SysMenu> selectMenuList() { return selectMenuList(new SysMenu()); } /** * Query menu list. * * @param menu query params * @return menu list */ @Override public List<SysMenu> selectMenuList(SysMenu menu) { List<SysMenu> menuList; int userId = StpUtil.getLoginIdAsInt(); if (User.isAdmin(userId)) { menuList = menuMapper.selectMenuList(menu); } else { menuList = menuMapper.selectMenuListByUserId(menu, userId); } return menuList; } /** * Query permissions by user ID. * * @param userId user ID * @return permission List */ @Override public Set<String> selectMenuPermsByUserId(Integer userId) { List<String> perms = menuMapper.selectMenuPermsByUserId(userId); Set<String> permsSet = new HashSet<>(); for (String perm : perms) { if (StringUtils.isNotEmpty(perm)) { permsSet.addAll(Arrays.asList(perm.trim().split(","))); } } return permsSet; } /** * Query permissions by role ID. * * @param roleId role ID * @return permission List */ @Override public Set<String> selectMenuPermsByRoleId(Integer roleId) { List<String> perms = menuMapper.selectMenuPermsByRoleId(roleId); Set<String> permsSet = new HashSet<>(); for (String perm : perms) { if (StringUtils.isNotEmpty(perm)) { permsSet.addAll(Arrays.asList(perm.trim().split(","))); } } return permsSet; } /** * Query menu list by user ID. * * @param userId user ID * @return menu list */ @Override public List<SysMenu> selectMenuTreeByUserId(Integer userId) { List<SysMenu> menus = null; if (userId != null && userId == 1) { menus = menuMapper.selectMenuTreeAll(); } else { menus = menuMapper.selectMenuTreeByUserId(userId); } return getChildPerms(menus, 0); } /** * Query menu tree information by role ID. * * @param roleId role ID * @return selected menu list */ @Override public List<Integer> selectMenuListByRoleId(Integer roleId) { return menuMapper.selectMenuListByRoleId(roleId); } /** * Build router by menu. * * @param menus menu list * @return router list */ @Override public List<RouterVO> buildMenus(List<SysMenu> menus) { List<RouterVO> routers = new LinkedList<RouterVO>(); for (SysMenu menu : menus) { RouterVO router = new RouterVO(); router.setHidden("1".equals(menu.getVisible())); router.setName(getRouteName(menu)); router.setPath(getRouterPath(menu)); router.setComponent(getComponent(menu)); router.setQuery(menu.getQuery()); router.setMeta( new MetaVO( menu.getMenuName(), menu.getIcon(), menu.getIsCache() == 1, menu.getPath())); List<SysMenu> cMenus = menu.getChildren(); if (!CollectionUtils.isEmpty(cMenus) && MenuType.DIR.getType().equals(menu.getType())) { router.setAlwaysShow(true); router.setRedirect("noRedirect"); router.setChildren(buildMenus(cMenus)); } else if (isMenuFrame(menu)) { router.setMeta(null); List<RouterVO> childrenList = new ArrayList<RouterVO>(); RouterVO children = new RouterVO(); children.setPath(menu.getPath()); children.setComponent(menu.getComponent()); children.setName(StringUtils.capitalize(menu.getPath())); children.setMeta( new MetaVO( menu.getMenuName(), menu.getIcon(), menu.getIsCache() == 1, menu.getPath())); children.setQuery(menu.getQuery()); childrenList.add(children); router.setChildren(childrenList); } else if (menu.getParentId() == 0 && isInnerLink(menu)) { router.setMeta(new MetaVO(menu.getMenuName(), menu.getIcon())); router.setPath("/"); List<RouterVO> childrenList = new ArrayList<RouterVO>(); RouterVO children = new RouterVO(); String routerPath = innerLinkReplaceEach(menu.getPath()); children.setPath(routerPath); children.setComponent(Constants.INNER_LINK); children.setName(StringUtils.capitalize(routerPath)); children.setMeta(new MetaVO(menu.getMenuName(), menu.getIcon(), menu.getPath())); childrenList.add(children); router.setChildren(childrenList); } routers.add(router); } return routers; } /** * Builder menu tree. * * @param menus menu list * @return menu tree */ @Override public List<SysMenu> buildMenuTree(List<SysMenu> menus) { List<SysMenu> returnList = new ArrayList<SysMenu>(); List<Integer> tempList = menus.stream().map(SysMenu::getId).collect(Collectors.toList()); for (Iterator<SysMenu> iterator = menus.iterator(); iterator.hasNext(); ) { SysMenu menu = (SysMenu) iterator.next(); if (!tempList.contains(menu.getParentId())) { recursionFn(menus, menu); returnList.add(menu); } } if (returnList.isEmpty()) { returnList = menus; } return returnList; } /** * Builder tree select by menu. * * @param menus menu list * @return menu tree select */ @Override public List<TreeSelect> buildMenuTreeSelect(List<SysMenu> menus) { List<SysMenu> menuTrees = buildMenuTree(menus); return menuTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); } /** * Query menu info by menu ID. * * @param menuId menu ID * @return menu info */ @Override public SysMenu selectMenuById(Integer menuId) { return menuMapper.selectMenuById(menuId); } /** * Is there a menu sub node present. * * @param menuId menu ID * @return result */ @Override public boolean hasChildByMenuId(Integer menuId) { int result = menuMapper.hasChildByMenuId(menuId); return result > 0; } /** * Query menu usage quantity. * * @param menuId menu ID * @return result */ @Override public boolean checkMenuExistRole(Integer menuId) { int result = roleMenuMapper.checkMenuExistRole(menuId); return result > 0; } /** * Add menu. * * @param menu menu info * @return result */ @Override public boolean insertMenu(SysMenu menu) { return this.save(menu); } /** * Update menu. * * @param menu menu info * @return result */ @Override public boolean updateMenu(SysMenu menu) { return this.updateById(menu); } /** * Delete menu. * * @param menuId menu ID * @return result */ @Override public boolean deleteMenuById(Integer menuId) { return this.removeById(menuId); } /** * Verify if the menu name is unique. * * @param menu menu info * @return result */ @Override public boolean checkMenuNameUnique(SysMenu menu) { Integer menuId = menu.getId() == null ? -1 : menu.getId(); SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId()); return info != null && !menuId.equals(info.getId()); } /** * Get router name. * * @param menu menu info * @return router name */ public String getRouteName(SysMenu menu) { String routerName = StringUtils.capitalize(menu.getPath()); if (isMenuFrame(menu)) { routerName = StringUtils.EMPTY; } return routerName; } /** * Get router path. * * @param menu menu info * @return router path */ public String getRouterPath(SysMenu menu) { String routerPath = menu.getPath(); if (menu.getParentId() != 0 && isInnerLink(menu)) { routerPath = innerLinkReplaceEach(routerPath); } if (0 == menu.getParentId() && MenuType.DIR.getType().equals(menu.getType()) && Constants.NO_FRAME == menu.getIsFrame()) { routerPath = "/" + menu.getPath(); } else if (isMenuFrame(menu)) { routerPath = "/"; } return routerPath; } /** * Get component information. * * @param menu menu info * @return component info */ public String getComponent(SysMenu menu) { String component = Constants.LAYOUT; if (StringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu)) { component = menu.getComponent(); } else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId() != 0 && isInnerLink(menu)) { component = Constants.INNER_LINK; } else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) { component = Constants.PARENT_VIEW; } return component; } /** * Is it a menu internal jump. * * @param menu menu info * @return result */ public boolean isMenuFrame(SysMenu menu) { return menu.getParentId() == 0 && MenuType.MENU.getType().equals(menu.getType()) && menu.getIsFrame().equals(Constants.NO_FRAME); } /** * Is it an internal chain component. * * @param menu menu info * @return result */ public boolean isInnerLink(SysMenu menu) { return menu.getIsFrame().equals(Constants.NO_FRAME) && StringUtils.isHttp(menu.getPath()); } /** * Is parent_view component. * * @param menu menu info * @return result */ public boolean isParentView(SysMenu menu) { return menu.getParentId() != 0 && MenuType.DIR.getType().equals(menu.getType()); } /** * Get all child nodes by the parent node ID. * * @param list menu list * @param parentId parent ID * @return menu list */ public List<SysMenu> getChildPerms(List<SysMenu> list, int parentId) { List<SysMenu> returnList = new ArrayList<SysMenu>(); for (SysMenu t : list) { if (t.getParentId() == parentId) { recursionFn(list, t); returnList.add(t); } } return returnList; } private void recursionFn(List<SysMenu> list, SysMenu t) { List<SysMenu> childList = getChildList(list, t); t.setChildren(childList); for (SysMenu tChild : childList) { if (hasChild(list, tChild)) { recursionFn(list, tChild); } } } private List<SysMenu> getChildList(List<SysMenu> list, SysMenu t) { List<SysMenu> tlist = new ArrayList<SysMenu>(); for (SysMenu n : list) { if (n.getParentId().equals(t.getId())) { tlist.add(n); } } return tlist; } private boolean hasChild(List<SysMenu> list, SysMenu t) { return getChildList(list, t).size() > 0; } public String innerLinkReplaceEach(String path) { return StringUtils.replaceEach( path, new String[] {Constants.HTTP, Constants.HTTPS, Constants.WWW, "."}, new String[] {"", "", "", "/"}); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/RoleMenuServiceImpl.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/service/impl/RoleMenuServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.service.impl; import org.apache.paimon.web.server.data.model.RoleMenu; import org.apache.paimon.web.server.mapper.RoleMenuMapper; import org.apache.paimon.web.server.service.RoleMenuService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** RoleMenuServiceImpl. */ @Service public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements RoleMenuService {}
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/WebSocketConfig.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/WebSocketConfig.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.configrue; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.messaging.simp.config.MessageBrokerRegistry; import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; import org.springframework.web.socket.config.annotation.StompEndpointRegistry; import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; /** Websocket config. */ @Configuration @EnableWebSocketMessageBroker public class WebSocketConfig implements WebSocketMessageBrokerConfigurer { @Value("${websocket.pool.size}") private int poolSize; @Value("${websocket.heartbeat.send}") private long sendHeartbeat; @Value("${websocket.heartbeat.receive}") private long receiveHeartbeat; @Bean public TaskScheduler webSocketTaskScheduler() { ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); scheduler.setPoolSize(poolSize); scheduler.setThreadNamePrefix("ws-heartbeat-thread-"); scheduler.initialize(); return scheduler; } @Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/ws").setAllowedOrigins("*"); } @Override public void configureMessageBroker(MessageBrokerRegistry registry) { registry.enableSimpleBroker("/topic") .setHeartbeatValue(new long[] {sendHeartbeat, receiveHeartbeat}) .setTaskScheduler(webSocketTaskScheduler()); registry.setApplicationDestinationPrefixes("/app"); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/MybatisPlusMetaObjectHandler.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/MybatisPlusMetaObjectHandler.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.configrue; import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.reflection.MetaObject; import org.springframework.stereotype.Component; import java.time.LocalDateTime; /** Auto fill createTime and updateTime filed config. */ @Slf4j @Component public class MybatisPlusMetaObjectHandler implements MetaObjectHandler { @Override public void insertFill(MetaObject metaObject) { this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now()); this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now()); } @Override public void updateFill(MetaObject metaObject) { this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now()); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/MybatisPlusConfig.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/MybatisPlusConfig.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.configrue; import org.apache.paimon.web.server.context.TenantContextHolder; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler; import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor; import com.google.common.collect.ImmutableSet; import net.sf.jsqlparser.expression.Expression; import net.sf.jsqlparser.expression.LongValue; import net.sf.jsqlparser.expression.NullValue; import org.mybatis.spring.annotation.MapperScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.Set; /** mybatis-plus config. */ @Configuration @MapperScan("org.apache.paimon.web.server.mapper") public class MybatisPlusConfig { /** need tenant table names. */ private static final Set<String> TENANT_TABLE_NAMES = ImmutableSet.of(""); @Bean public MybatisPlusInterceptor mybatisPlusInterceptor() { MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); interceptor.addInnerInterceptor( new TenantLineInnerInterceptor( new TenantLineHandler() { @Override public Expression getTenantId() { Long tenantId = TenantContextHolder.get(); if (tenantId == null) { return new NullValue(); } return new LongValue(tenantId); } @Override public boolean ignoreTable(String tableName) { return !TENANT_TABLE_NAMES.contains(tableName); } })); interceptor.addInnerInterceptor(new PaginationInnerInterceptor()); return interceptor; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/GlobalExceptionHandler.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/GlobalExceptionHandler.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.configrue; import org.apache.paimon.web.server.data.result.R; import org.apache.paimon.web.server.data.result.enums.Status; import org.apache.paimon.web.server.data.result.exception.BaseException; import org.apache.paimon.web.server.util.MessageUtils; import cn.dev33.satoken.exception.NotLoginException; import cn.dev33.satoken.exception.NotPermissionException; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.context.support.DefaultMessageSourceResolvable; import org.springframework.dao.DataAccessException; import org.springframework.http.HttpStatus; import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.validation.BindException; import org.springframework.validation.FieldError; import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolationException; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.Set; /** GlobalExceptionHandler. */ @Slf4j @ControllerAdvice @ResponseBody public class GlobalExceptionHandler { @ExceptionHandler public R<Void> bizException(BaseException e) { if (e.getStatus() == null) { return R.failed(Status.INTERNAL_SERVER_ERROR_ARGS); } return R.failed(e.getStatus(), e.getArgs()); } @ResponseStatus(HttpStatus.UNAUTHORIZED) @ExceptionHandler public R<Void> notLoginException(NotLoginException e) { return R.failed(Status.UNAUTHORIZED); } @ResponseStatus(HttpStatus.FORBIDDEN) @ExceptionHandler public R<Void> notPermissionException(NotPermissionException e) { return R.failed(Status.FORBIDDEN); } @ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED) @ExceptionHandler public R<Void> notLoginException(HttpRequestMethodNotSupportedException e) { return R.failed(Status.METHOD_NOT_ALLOWED); } @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) @ExceptionHandler() public R<Void> notLoginException(DataAccessException e) { log.error("SQLException", e); return R.failed(Status.UNKNOWN_ERROR, "sql error"); } @ResponseStatus(HttpStatus.BAD_REQUEST) @ExceptionHandler(BindException.class) public R<Void> bindExceptionHandler(BindException e) { List<FieldError> fieldErrors = e.getBindingResult().getFieldErrors(); Optional<String> msg = fieldErrors.stream() .filter(Objects::nonNull) .map(DefaultMessageSourceResolvable::getDefaultMessage) .filter(StringUtils::isNotBlank) .findFirst(); return msg.<R<Void>>map(s -> R.failed(Status.REQUEST_PARAMS_ERROR, MessageUtils.getMsg(s))) .orElseGet(() -> R.failed(Status.REQUEST_PARAMS_ERROR)); } @ResponseStatus(HttpStatus.BAD_REQUEST) @ExceptionHandler(ConstraintViolationException.class) public R<Void> constraintViolationExceptionHandler(ConstraintViolationException e) { Set<ConstraintViolation<?>> constraintViolations = e.getConstraintViolations(); Optional<String> msg = constraintViolations.stream() .filter(Objects::nonNull) .map(ConstraintViolation::getMessage) .findFirst(); return msg.<R<Void>>map(s -> R.failed(Status.REQUEST_PARAMS_ERROR, s)) .orElseGet(() -> R.failed(Status.REQUEST_PARAMS_ERROR)); } @ResponseStatus(HttpStatus.BAD_REQUEST) @ExceptionHandler(HttpMessageNotReadableException.class) public R<Void> constraintViolationExceptionHandler(HttpMessageNotReadableException e) { return R.failed(Status.REQUEST_PARAMS_ERROR, "Required request body is missing"); } @ExceptionHandler public R<Void> unknownException(Exception e) { log.error("UnknownException", e); return R.failed(Status.UNKNOWN_ERROR, e.getMessage()); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/CorsConfig.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/CorsConfig.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.configrue; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Bean; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; /** CorsConfig. */ @Slf4j // @Configuration public class CorsConfig { @Bean public CorsFilter corsFilter() { CorsConfiguration corsConfiguration = new CorsConfiguration(); corsConfiguration.setAllowCredentials(true); corsConfiguration.addAllowedHeader("*"); corsConfiguration.addAllowedMethod("*"); corsConfiguration.addExposedHeader("*"); corsConfiguration.addAllowedOrigin("http://127.0.0.1:5173"); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", corsConfiguration); return new CorsFilter(source); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/JacksonConfig.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/JacksonConfig.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.configrue; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.format.DateTimeFormatter; /** JacksonConfig. */ @Configuration public class JacksonConfig { public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static final String DATE_FORMAT = "yyyy-MM-dd"; public static final String TIME_FORMAT = "HH:mm:ss"; @Bean public ObjectMapper getJacksonObjectMapper() { ObjectMapper objectMapper = new ObjectMapper(); // When the sequence is changed to json, all longs will be changed to strings. // Because the numeric type in js cannot contain all java long values, precision will be // lost after more than 16 digits. SimpleModule simpleModule = new SimpleModule(); simpleModule.addSerializer( Long.class, com.fasterxml.jackson.databind.ser.std.ToStringSerializer.instance); simpleModule.addSerializer( Long.TYPE, com.fasterxml.jackson.databind.ser.std.ToStringSerializer.instance); objectMapper.registerModule(simpleModule); // If there are more attributes during deserialization, no exception will be thrown. objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); // Date format handling. JavaTimeModule javaTimeModule = new JavaTimeModule(); javaTimeModule.addSerializer( LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT))); javaTimeModule.addDeserializer( LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT))); javaTimeModule.addSerializer( LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DATE_FORMAT))); javaTimeModule.addDeserializer( LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DATE_FORMAT))); javaTimeModule.addSerializer( LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(TIME_FORMAT))); javaTimeModule.addDeserializer( LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(TIME_FORMAT))); objectMapper.registerModule(javaTimeModule); objectMapper.setDateFormat(new SimpleDateFormat(DATE_TIME_FORMAT)); objectMapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); return objectMapper; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/SaTokenConfigurer.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/SaTokenConfigurer.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.configrue; import cn.dev33.satoken.interceptor.SaInterceptor; import cn.dev33.satoken.stp.StpUtil; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** Sa-Token path config. */ @Configuration public class SaTokenConfigurer implements WebMvcConfigurer { @Value("${interceptor.exclude.path.patterns}") private String[] excludePathPatterns; @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin())) .addPathPatterns("/**") .excludePathPatterns(excludePathPatterns); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/RetryConfig.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/RetryConfig.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.configrue; import org.springframework.context.annotation.Configuration; import org.springframework.retry.annotation.EnableRetry; /** RetryConfig. */ @EnableRetry @Configuration public class RetryConfig {}
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/AppConfiguration.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/configrue/AppConfiguration.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.configrue; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.util.Optional; /** AppConfiguration. */ @Configuration public class AppConfiguration implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { String uiPath = Optional.ofNullable(System.getenv("UI_PATH")).orElse("file:ui/"); registry.addResourceHandler("/ui/**").addResourceLocations(uiPath); } @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("redirect:/ui/"); registry.addViewController("/ui/").setViewName("forward:/ui/index.html"); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/CdcJobDefinitionDTO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/CdcJobDefinitionDTO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.dto; import lombok.Data; import javax.validation.constraints.NotBlank; /** DTO of cdcJobDefinition . */ @Data public class CdcJobDefinitionDTO { private Integer id; @NotBlank(message = "invalid.cdc.job.name") private String name; private String description; private Integer cdcType; private String config; private String createUser; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/DatabaseDTO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/DatabaseDTO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.dto; import lombok.Data; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; /** DTO of database. */ @Data public class DatabaseDTO { @NotBlank(message = "invalid.databaseName") private String name; @NotNull(message = "invalid.catalogId") private Integer catalogId; private String catalogName; private boolean ignoreIfExists; private boolean cascade; private String description; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/TableDTO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/TableDTO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.dto; import org.apache.paimon.web.server.data.model.TableColumn; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.util.List; import java.util.Map; /** DTO of table. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class TableDTO { @NotNull(message = "invalid.catalogId") private Integer catalogId; private String catalogName; @NotBlank(message = "invalid.databaseName") private String databaseName; @NotBlank(message = "invalid.tableName") private String name; private String description; private List<TableColumn> tableColumns; private List<String> partitionKey; private Map<String, String> tableOptions; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/StopJobDTO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/StopJobDTO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.dto; import lombok.Data; /** DTO of stopping job. */ @Data public class StopJobDTO { private String clusterId; private String jobId; private String taskType; private boolean withSavepoint; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/JobSubmitDTO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/JobSubmitDTO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.dto; import lombok.Data; import java.util.Map; /** DTO of submitting job. */ @Data public class JobSubmitDTO { private String jobName; private String fileName; private String taskType; private boolean isStreaming; private String clusterId; private Map<String, String> config; private String statements; private int maxRows; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/AlterTableDTO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/AlterTableDTO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.dto; import org.apache.paimon.web.server.data.model.TableColumn; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.util.List; /** DTO of alter table. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class AlterTableDTO { private String catalogName; private String databaseName; private String tableName; private List<TableColumn> tableColumns; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/MetadataDTO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/MetadataDTO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.dto; import lombok.Data; /** DTO of metadata. */ @Data public class MetadataDTO { private Integer catalogId; private String databaseName; private String tableName; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/CdcJobSubmitDTO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/CdcJobSubmitDTO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.dto; import lombok.Data; /** DTO of CdcJobSubmit. */ @Data public class CdcJobSubmitDTO { private String clusterId; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/CatalogDTO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/CatalogDTO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.dto; import com.baomidou.mybatisplus.annotation.TableLogic; import lombok.Data; import javax.validation.constraints.NotBlank; import java.util.Map; /** DTO of catalog. */ @Data public class CatalogDTO { private Integer id; @NotBlank(message = "invalid.catalogType") private String type; @NotBlank(message = "invalid.catalogName") private String name; @NotBlank(message = "invalid.warehouseDir") private String warehouse; private Map<String, String> options; @TableLogic private boolean isDelete; public String getHiveConfDir() { if (options == null) { return null; } return options.get("hiveConfDir"); } public String getHiveUri() { if (options == null) { return null; } return options.get("hiveUri"); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/ResultFetchDTO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/ResultFetchDTO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.dto; import lombok.Data; /** DTO of fetching result. */ @Data public class ResultFetchDTO { private String submitId; private String clusterId; private String sessionId; private String taskType; private Long token; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/UserWithRolesDTO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/UserWithRolesDTO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.dto; import org.apache.paimon.web.server.data.model.SysRole; import org.apache.paimon.web.server.data.model.User; import lombok.Data; import lombok.EqualsAndHashCode; import java.util.List; /** DTO of UserWithRoles. */ @Data @EqualsAndHashCode(callSuper = true) public class UserWithRolesDTO extends User { private List<SysRole> roles; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/RoleWithUserDTO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/RoleWithUserDTO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.dto; import lombok.Data; import java.util.List; /** DTO of role user relation. */ @Data public class RoleWithUserDTO { private Integer roleId; private String username; private String mobile; private List<Integer> userIds; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/SessionDTO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/SessionDTO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.dto; import lombok.Data; /** DTO of session. */ @Data public class SessionDTO { private Integer uid; private Integer clusterId; private String host; private Integer port; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/LoginDTO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/dto/LoginDTO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.dto; import lombok.Data; import javax.validation.constraints.NotBlank; /** DTO of login. */ @Data public class LoginDTO { /** login username. */ @NotBlank(message = "username is required") private String username; /** login password. */ @NotBlank(message = "password is required") private String password; /** remember me flag. */ private boolean rememberMe; /** ldap login flag. */ private boolean ldapLogin; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/RoleMenu.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/RoleMenu.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import lombok.Data; import lombok.EqualsAndHashCode; /** role_menu table. */ @Data @EqualsAndHashCode(callSuper = true) public class RoleMenu extends BaseModel { /** role id. */ private Integer roleId; /** menu id. */ private Integer menuId; private static final long serialVersionUID = 1L; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/SysMenu.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/SysMenu.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import com.baomidou.mybatisplus.annotation.TableField; import lombok.Data; import lombok.EqualsAndHashCode; import java.util.ArrayList; import java.util.List; /** sys_menu table. */ @Data @EqualsAndHashCode(callSuper = true) public class SysMenu extends BaseModel { /** menu name. */ private String menuName; /** parent id. */ private Integer parentId; /** sort. */ private Integer sort; /** route path. */ private String path; /** route params. */ private String query; /** is cache(0:cache 1:no_cache). */ private Integer isCache; /** menu type(M:directory C:menu F:button). */ private String type; /** is visible(0:display 1:hide). */ private String visible; /** component path. */ private String component; /** is frame. */ private Integer isFrame; /** is enable. */ private Boolean enabled; /** is delete. */ private Boolean isDelete; /** menu perms. */ private String perms; /** menu icon. */ private String icon; /** remark. */ private String remark; /** children menu. */ @TableField(exist = false) private List<SysMenu> children = new ArrayList<SysMenu>(); private static final long serialVersionUID = 1L; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/Tenant.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/Tenant.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import com.baomidou.mybatisplus.annotation.TableLogic; import lombok.Data; import lombok.EqualsAndHashCode; /** tenant use to isolate data. */ @Data @EqualsAndHashCode(callSuper = true) public class Tenant extends BaseModel { private static final long serialVersionUID = 1L; /** tenant name. */ private String name; /** tenant description. */ private String description; /** is delete. */ @TableLogic private Boolean isDelete; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/JobInfo.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/JobInfo.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import com.baomidou.mybatisplus.annotation.TableName; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import java.time.LocalDateTime; /** Job table model. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = true) @TableName("job") public class JobInfo extends BaseModel { private String jobId; private String jobName; private String fileName; private String type; private String executeMode; private String clusterId; private Integer uid; private String config; private String statements; private String status; private LocalDateTime startTime; private LocalDateTime endTime; private static final long serialVersionUID = 1L; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/UserTenant.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/UserTenant.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import com.baomidou.mybatisplus.annotation.TableLogic; import lombok.Data; import lombok.EqualsAndHashCode; /** user_tenant table model. */ @Data @EqualsAndHashCode(callSuper = true) public class UserTenant extends BaseModel { private static final long serialVersionUID = 1L; /** user id. */ private Integer userId; /** tenant id. */ @TableLogic private Integer tenantId; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/MetadataOptionModel.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/MetadataOptionModel.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; /** Model of metadata options. */ @Data @NoArgsConstructor @AllArgsConstructor public class MetadataOptionModel { private String key; private Object value; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/UserRole.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/UserRole.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import lombok.Data; import lombok.EqualsAndHashCode; /** user_role. */ @Data @EqualsAndHashCode(callSuper = true) public class UserRole extends BaseModel { /** user id. */ private Integer userId; /** role id. */ private Integer roleId; private static final long serialVersionUID = 1L; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/ClusterInfo.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/ClusterInfo.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import com.baomidou.mybatisplus.annotation.TableName; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import javax.validation.constraints.Max; import javax.validation.constraints.Min; import javax.validation.constraints.NotBlank; import java.time.LocalDateTime; /** Cluster table model. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = true) @TableName("cluster") public class ClusterInfo extends BaseModel { private static final long serialVersionUID = 1L; @NotBlank(message = "invalid.clusterName") private String clusterName; @NotBlank(message = "invalid.host") private String host; @Min(value = 1, message = "invalid.min.port") @Max(value = 65535, message = "invalid.max.port") private Integer port; @NotBlank(message = "invalid.clusterType") private String type; private String deploymentMode; private Boolean enabled; private String heartbeatStatus; private LocalDateTime lastHeartbeat; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/History.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/History.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import com.baomidou.mybatisplus.annotation.TableName; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; /** History table model. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = true) @TableName("history") public class History extends BaseModel { private String name; private String taskType; private Boolean isStreaming; private Integer uid; private Integer clusterId; private String statements; private static final long serialVersionUID = 1L; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/TableColumn.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/TableColumn.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import org.apache.paimon.web.server.util.PaimonDataType; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.annotation.Nullable; /** TableColumn model. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class TableColumn { private Integer id; private String field; private PaimonDataType dataType; @Nullable private String comment; @Nullable private boolean isPk; @Nullable private String defaultValue; private Integer sort; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/MetadataFieldsModel.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/MetadataFieldsModel.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; /** Model of metadata fields. */ @Data @NoArgsConstructor @AllArgsConstructor public class MetadataFieldsModel { private int id; private String name; private String type; private String description; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/StatementInfo.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/StatementInfo.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import com.baomidou.mybatisplus.annotation.TableName; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; /** Statement info table model. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = true) @TableName("statement") public class StatementInfo extends BaseModel { private String statementName; private String taskType; private Boolean isStreaming; private Integer uid; private Integer clusterId; private String statements; private static final long serialVersionUID = 1L; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/User.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/User.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import org.apache.paimon.web.server.constant.Constants; import org.apache.paimon.web.server.data.enums.UserType; import org.apache.paimon.web.server.validator.annotation.PhoneNumber; import com.baomidou.mybatisplus.annotation.TableField; import lombok.Data; import lombok.EqualsAndHashCode; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; /** user table model. */ @Data @EqualsAndHashCode(callSuper = true) public class User extends BaseModel { private static final long serialVersionUID = 1L; /** username. */ @NotBlank(message = "invalid.username") private String username; /** password. */ private String password; /** nickname. */ private String nickname; /** login type (0:LOCAL,1:LDAP). */ private UserType userType; /** mobile phone. */ @PhoneNumber private String mobile; /** email. */ @Email(message = "invalid.email.format") private String email; /** is enable. */ private Boolean enabled; /** avatar url. */ private String url; /** role ids. */ @TableField(exist = false) @NotEmpty(message = "invalid.roleIds") private Integer[] roleIds; public boolean isAdmin() { return isAdmin(this.getId()); } public static boolean isAdmin(Integer userId) { return userId != null && Constants.ADMIN_ID == userId; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/CdcJobDefinition.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/CdcJobDefinition.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableName; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import java.io.Serializable; /** Model of cdc_job_definition. */ @TableName(value = "cdc_job_definition") @Data @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = true) @Builder public class CdcJobDefinition extends BaseModel implements Serializable { private String name; private String description; private Integer cdcType; private String config; private String createUser; @TableLogic private boolean isDelete; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/BaseModel.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/BaseModel.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; import java.util.HashMap; import java.util.Map; /** base model of table. */ @Data public abstract class BaseModel implements Serializable { /** id. */ @TableId(type = IdType.AUTO) private Integer id; /** create time. */ @TableField(fill = FieldFill.INSERT) private LocalDateTime createTime; /** update time. */ @TableField(fill = FieldFill.INSERT_UPDATE) private LocalDateTime updateTime; @TableField(exist = false) @JsonInclude(JsonInclude.Include.NON_EMPTY) private Map<String, Object> params; public Map<String, Object> getParams() { if (params == null) { params = new HashMap<>(8); } return params; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/CatalogInfo.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/CatalogInfo.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import java.util.Map; /** Catalog table model. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = true) @TableName(value = "catalog", autoResultMap = true) public class CatalogInfo extends BaseModel { private String catalogType; private String catalogName; private String warehouse; @TableField(typeHandler = JacksonTypeHandler.class) private Map<String, String> options; @TableLogic private boolean isDelete; public String getHiveConfDir() { if (options == null) { return null; } return options.get("hiveConfDir"); } public String getHiveUri() { if (options == null) { return null; } return options.get("hiveUri"); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/SysRole.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/SysRole.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model; import org.apache.paimon.web.server.constant.Constants; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableLogic; import lombok.Data; import lombok.EqualsAndHashCode; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import java.util.Set; /** sys_role. */ @Data @EqualsAndHashCode(callSuper = true) public class SysRole extends BaseModel { /** role name. */ @NotBlank(message = "invalid.roleName") private String roleName; /** role key. */ @NotBlank(message = "invalid.roleKey") private String roleKey; /** sort. */ private Integer sort; /** is enable. */ private Boolean enabled; /** is delete. */ @TableLogic private Boolean isDelete; /** remark. */ private String remark; /** Does the user have this role identity. Default false. */ @TableField(exist = false) private boolean flag = false; /** menu ids. */ @TableField(exist = false) @NotEmpty(message = "invalid.menuIds") private Integer[] menuIds; /** indeterminate keys. */ @TableField(exist = false) private Integer[] indeterminateKeys; /** Role menu permissions. */ @TableField(exist = false) private Set<String> permissions; public boolean isAdmin() { return isAdmin(this.getId()); } public static boolean isAdmin(Integer roleId) { return roleId != null && Constants.ADMIN_ID == roleId; } private static final long serialVersionUID = 1L; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/cdc/CdcGraph.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/cdc/CdcGraph.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model.cdc; import org.apache.paimon.web.common.util.JSONUtils; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import lombok.Getter; import java.util.ArrayList; import java.util.List; import java.util.Objects; /** CdcGraph. */ @Getter public class CdcGraph { private CdcNode source; private CdcNode target; public static CdcGraph fromCdcGraphJsonString(String json) { CdcGraph cdcGraph = new CdcGraph(); try { List<JsonNode> edges = new ArrayList<>(); List<JsonNode> nodes = new ArrayList<>(); ObjectMapper objectMapper = JSONUtils.getObjectMapper(); JsonNode cdcGraphJson = objectMapper.readTree(json); ArrayNode cellsJson = (ArrayNode) cdcGraphJson.get("cells"); cellsJson.forEach( e -> { String shape = e.get("shape").asText(); if ("dag-edge".equals(shape)) { edges.add(e); } else { nodes.add(e); } }); if (edges.size() != 1 && nodes.size() != 2) { throw new RuntimeException("The number of cdc graph nodes is abnormal."); } JsonNode jsonNode = edges.get(0); JsonNode sourceTypeJson = jsonNode.get("source"); String sourceType = sourceTypeJson.get("cell").asText(); JsonNode targetTypeJson = jsonNode.get("target"); String targetType = targetTypeJson.get("cell").asText(); CdcNode source = new CdcNode(); CdcNode target = new CdcNode(); for (JsonNode node : nodes) { ObjectNode data = (ObjectNode) node.get("data"); String type = node.get("id").asText(); if (Objects.equals(sourceType, type)) { source.setType(type); source.setData(data); } if (Objects.equals(targetType, type)) { target.setType(type); target.setData(data); } } cdcGraph.source = source; cdcGraph.target = target; } catch (Exception e) { throw new RuntimeException("CdcGraph is not supported:" + e.getMessage(), e); } return cdcGraph; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/cdc/CdcNode.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/model/cdc/CdcNode.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.model.cdc; import com.fasterxml.jackson.databind.node.ObjectNode; import lombok.Data; /** CdcNode. */ @Data public class CdcNode { private String type; private ObjectNode data; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/PageR.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/PageR.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.result; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Builder; import lombok.Data; import java.io.Serializable; import java.util.List; /** Paging Results. */ @Data @Builder public class PageR<T> implements Serializable { private static final long serialVersionUID = -5143774412936881374L; /** total. */ private final long total; /** is success. */ private final boolean success; /** result data. */ private final List<T> data; public PageR( @JsonProperty("total") long total, @JsonProperty("success") boolean success, @JsonProperty("data") List<T> data) { this.total = total; this.success = success; this.data = data; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/R.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/R.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.result; import org.apache.paimon.web.server.data.result.enums.Status; import org.apache.paimon.web.server.util.MessageUtils; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; /** result. */ @Data public class R<T> { /** result code. */ private final int code; /** result msg. */ private final String msg; /** result data. */ private final T data; public R( @JsonProperty("code") int code, @JsonProperty("msg") String msg, @JsonProperty("data") T data) { this.code = code; this.msg = msg; this.data = data; } public static <T> R<T> of(T data, int code, String msg) { return new R<>(code, msg, data); } public static <T> R<T> of(T data, int code, Status status) { return new R<>(code, status.getMsg(), data); } public static <T> R<T> succeed() { return of(null, Status.SUCCESS.getCode(), MessageUtils.getMsg(Status.SUCCESS.getMsg())); } public static <T> R<T> succeed(T data) { return of(data, Status.SUCCESS.getCode(), MessageUtils.getMsg(Status.SUCCESS.getMsg())); } public static <T> R<T> failed() { return of(null, Status.FAILED.getCode(), Status.FAILED.getMsg()); } public static <T> R<T> failed(Status status) { return of(null, status.getCode(), MessageUtils.getMsg(status.getMsg())); } public static <T> R<T> failed(Status status, Object... args) { return of(null, status.getCode(), MessageUtils.getMsg(status.getMsg(), args)); } public static <T> R<T> failed(T data) { return of(data, Status.FAILED.getCode(), MessageUtils.getMsg(Status.FAILED.getMsg())); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/exception/BaseException.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/exception/BaseException.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.result.exception; import org.apache.paimon.web.server.data.result.enums.Status; /** base exception. */ public abstract class BaseException extends RuntimeException { /** status. */ private final Status status; /** msg args. */ private final Object[] args; public BaseException(Status status, Object[] args) { this.status = status; this.args = args; } public BaseException(Status status) { this(status, null); } public Status getStatus() { return status; } public Object[] getArgs() { return args; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/exception/user/UserDisabledException.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/exception/user/UserDisabledException.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.result.exception.user; import org.apache.paimon.web.server.data.result.enums.Status; import org.apache.paimon.web.server.data.result.exception.BaseException; /** Exception to user disabled. */ public class UserDisabledException extends BaseException { private static final long serialVersionUID = 1L; public UserDisabledException() { super(Status.USER_DISABLED_ERROR); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/exception/user/UserPasswordNotMatchException.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/exception/user/UserPasswordNotMatchException.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.result.exception.user; import org.apache.paimon.web.server.data.result.enums.Status; import org.apache.paimon.web.server.data.result.exception.BaseException; /** Exception to user password not match. */ public class UserPasswordNotMatchException extends BaseException { private static final long serialVersionUID = 1L; public UserPasswordNotMatchException() { super(Status.USER_PASSWORD_ERROR); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/exception/user/UserNotBindTenantException.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/exception/user/UserNotBindTenantException.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.result.exception.user; import org.apache.paimon.web.server.data.result.enums.Status; import org.apache.paimon.web.server.data.result.exception.BaseException; /** Exception to user not bind tenant. */ public class UserNotBindTenantException extends BaseException { private static final long serialVersionUID = 1L; public UserNotBindTenantException() { super(Status.USER_DISABLED_ERROR); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/exception/user/UserNotExistsException.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/exception/user/UserNotExistsException.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.result.exception.user; import org.apache.paimon.web.server.data.result.enums.Status; import org.apache.paimon.web.server.data.result.exception.BaseException; /** Exception to user not exists. */ public class UserNotExistsException extends BaseException { public UserNotExistsException() { super(Status.USER_NOT_EXIST); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/exception/role/RoleInUsedException.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/exception/role/RoleInUsedException.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.result.exception.role; import org.apache.paimon.web.server.data.result.enums.Status; import org.apache.paimon.web.server.data.result.exception.BaseException; /** Exception to role in used. */ public class RoleInUsedException extends BaseException { public RoleInUsedException(Object... args) { super(Status.ROLE_IN_USED, args); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/enums/Status.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/result/enums/Status.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.result.enums; /** * Status enum. * * <p><b>NOTE:</b> This enumeration is used to define status codes and internationalization messages * for response data. <br> * This is mainly responsible for the internationalization information returned by the interface */ public enum Status { /** response data msg. */ SUCCESS(200, "successfully"), FAILED(400, "failed"), UNAUTHORIZED(401, "unauthorized"), FORBIDDEN(403, "forbidden"), METHOD_NOT_ALLOWED(405, "method.not.allowed"), // TODO UNKNOWN_ERROR(500, "unknown.error"), INTERNAL_SERVER_ERROR_ARGS(501, "internal.server.error"), REQUEST_PARAMS_NOT_VALID_ERROR(4001, "invalid.request.parameter"), REQUEST_PARAMS_ERROR(4002, "request.parameter.error"), /** ------------user-----------------. */ USER_NOT_EXIST(10001, "user.not.exist"), USER_PASSWORD_ERROR(10002, "user.password.error"), USER_DISABLED_ERROR(10003, "user.is.disabled"), USER_NOT_BING_TENANT(10004, "user.not.bing.tenant"), USER_NAME_ALREADY_EXISTS(10005, "user.name.exist"), /** ------------role-----------------. */ ROLE_IN_USED(10101, "role.in.used"), ROLE_NAME_IS_EXIST(10102, "role.name.exist"), ROLE_KEY_IS_EXIST(10103, "role.key.exist"), /** ------------menu-----------------. */ MENU_IN_USED(10201, "menu.in.used"), MENU_NAME_IS_EXIST(10202, "menu.name.exist"), MENU_PATH_INVALID(10203, "menu.path.invalid"), /** ------------catalog-----------------. */ CATALOG_NAME_IS_EXIST(10301, "catalog.name.exist"), CATALOG_CREATE_ERROR(10302, "catalog.create.error"), CATALOG_REMOVE_ERROR(10303, "catalog.remove.error"), CATALOG_NOT_EXIST(10304, "catalog.not.exists"), /** ------------database-----------------. */ DATABASE_NAME_IS_EXIST(10401, "database.name.exist"), DATABASE_CREATE_ERROR(10402, "database.create.error"), DATABASE_DROP_ERROR(10403, "database.drop.error"), /** ------------table-----------------. */ TABLE_NAME_IS_EXIST(10501, "table.name.exist"), TABLE_CREATE_ERROR(10502, "table.create.error"), TABLE_ADD_COLUMN_ERROR(10503, "table.add.column.error"), TABLE_ADD_OPTION_ERROR(10504, "table.add.option.error"), TABLE_REMOVE_OPTION_ERROR(10505, "table.remove.option.error"), TABLE_DROP_COLUMN_ERROR(10506, "table.drop.column.error"), TABLE_AlTER_COLUMN_ERROR(10507, "table.alter.column.error"), TABLE_DROP_ERROR(10510, "table.drop.error"), TABLE_RENAME_ERROR(10511, "table.rename.error"), /** ------------cdc-----------------. */ CDC_JOB_EXIST_ERROR(10601, "cdc.job.exist.error"), CDC_JOB_NO_EXIST_ERROR(10602, "cdc.job.not.exist.error"), /** ------------cluster-----------------. */ CLUSTER_NOT_EXIST(10701, "cluster.not.exist"), CLUSTER_NAME_ALREADY_EXISTS(10702, "cluster.name.exist"), /** ------------job-----------------. */ JOB_SUBMIT_ERROR(10701, "job.submit.error"), RESULT_FETCH_ERROR(10702, "result.fetch.error"), JOB_STOP_ERROR(10703, "job.stop.error"), JOB_UPDATE_STATUS_ERROR(10704, "job.update.status.error"), /** ------------cluster-----------------. */ STATEMENT_NOT_EXIST(10801, "statement.not.exist"), STATEMENT_NAME_ALREADY_EXISTS(10802, "statement.name.exist"); private final int code; private final String msg; Status(int code, String msg) { this.code = code; this.msg = msg; } public int getCode() { return this.code; } public String getMsg() { return this.msg; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/JobStatusVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/JobStatusVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** VO of JobStatus. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class JobStatusVO { private String jobId; private String status; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/DataFileVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/DataFileVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.time.LocalDateTime; /** VO of metadata data file. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class DataFileVO { private String partition; private Integer bucket; private String filePath; private String fileFormat; private Long schemaId; private Integer level; private Long recordCount; private Long fileSizeInBytes; private String minKey; private String maxKey; private String nullValueCounts; private String minValueStats; private String maxValueStats; private Long minSequenceNumber; private Long maxSequenceNumber; private LocalDateTime creationTime; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/UserVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/UserVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import org.apache.paimon.web.server.data.enums.UserType; import org.apache.paimon.web.server.data.model.SysRole; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.time.LocalDateTime; import java.util.List; /** VO of User. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class UserVO { private Integer id; private String username; private String nickname; private UserType userType; private String mobile; private String email; private Boolean enabled; private LocalDateTime createTime; private LocalDateTime updateTime; private List<SysRole> roles; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/ManifestsVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/ManifestsVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** VO of metadata manifest. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class ManifestsVO { private String fileName; private Long fileSize; private Long numAddedFiles; private Long numDeletedFiles; private Long schemaId; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/RouterVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/RouterVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import com.fasterxml.jackson.annotation.JsonInclude; import java.util.List; /** route config info. */ @JsonInclude(JsonInclude.Include.NON_EMPTY) public class RouterVO { /** route name. */ private String name; /** route path. */ private String path; /** * Do you want to hide the route? When true is set, the route will no longer appear in the * sidebar. */ private boolean hidden; /** * Redirect address. When setting noRedirect, the route cannot be clicked in Breadcrumb * navigation. */ private String redirect; /** component path. */ private String component; /** route query params:eg. {"id": 1, "name": "xx"}. */ private String query; /** * When there are more than one routes declared by children under a route, it will * automatically. become nested mode - such as component pages */ private Boolean alwaysShow; /** other meta info. */ private MetaVO meta; /** children route. */ private List<RouterVO> children; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } public boolean getHidden() { return hidden; } public void setHidden(boolean hidden) { this.hidden = hidden; } public String getRedirect() { return redirect; } public void setRedirect(String redirect) { this.redirect = redirect; } public String getComponent() { return component; } public void setComponent(String component) { this.component = component; } public String getQuery() { return query; } public void setQuery(String query) { this.query = query; } public Boolean getAlwaysShow() { return alwaysShow; } public void setAlwaysShow(Boolean alwaysShow) { this.alwaysShow = alwaysShow; } public MetaVO getMeta() { return meta; } public void setMeta(MetaVO meta) { this.meta = meta; } public List<RouterVO> getChildren() { return children; } public void setChildren(List<RouterVO> children) { this.children = children; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/JobVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/JobVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.time.LocalDateTime; import java.util.List; import java.util.Map; /** VO of job. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class JobVO { private String submitId; private String jobId; private String jobName; private String fileName; private String type; private String executeMode; private String clusterId; private String sessionId; private Integer uid; private String status; private Boolean shouldFetchResult; private List<Map<String, Object>> resultData; private Long token; private LocalDateTime startTime; private LocalDateTime endTime; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/MetaVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/MetaVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import org.apache.paimon.web.server.util.StringUtils; /** Route display information. */ public class MetaVO { /** Set the name of the route displayed in the sidebar and Bread crumbs. */ private String title; /** Set the icon for this route. */ private String icon; /** cache or no. */ private boolean noCache; /** link path. */ private String link; public MetaVO() {} public MetaVO(String title, String icon) { this.title = title; this.icon = icon; } public MetaVO(String title, String icon, boolean noCache) { this.title = title; this.icon = icon; this.noCache = noCache; } public MetaVO(String title, String icon, String link) { this.title = title; this.icon = icon; this.link = link; } public MetaVO(String title, String icon, boolean noCache, String link) { this.title = title; this.icon = icon; this.noCache = noCache; if (StringUtils.isHttp(link)) { this.link = link; } } public boolean isNoCache() { return noCache; } public void setNoCache(boolean noCache) { this.noCache = noCache; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public String getLink() { return link; } public void setLink(String link) { this.link = link; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/DatabaseVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/DatabaseVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** VO of database. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class DatabaseVO { private String name; private Integer catalogId; private String catalogName; private String description; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/ResultDataVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/ResultDataVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.util.List; import java.util.Map; /** VO of result data. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class ResultDataVO { private List<Map<String, Object>> resultData; private Integer columns; private Integer rows; private Long token; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/SnapshotVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/SnapshotVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.time.LocalDateTime; /** VO of metadata snapshot. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class SnapshotVO { private Long snapshotId; private Long schemaId; private String commitUser; private Long commitIdentifier; private String commitKind; private LocalDateTime commitTime; private String baseManifestList; private String deltaManifestList; private String changelogManifestList; private Long totalRecordCount; private Long deltaRecordCount; private Long changelogRecordCount; private Long watermark; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/UserInfoVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/UserInfoVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import org.apache.paimon.web.server.data.model.SysMenu; import org.apache.paimon.web.server.data.model.SysRole; import org.apache.paimon.web.server.data.model.Tenant; import org.apache.paimon.web.server.data.model.User; import cn.dev33.satoken.stp.SaTokenInfo; import lombok.Data; import java.util.List; /** user data transfer object. */ @Data public class UserInfoVO { /** current user info. */ private User user; /** current user's tenant list. */ private List<Tenant> tenantList; /** current user's role list. */ private List<SysRole> roleList; /** current user's token info. */ private SaTokenInfo saTokenInfo; /** current user's menu list. */ private List<SysMenu> sysMenuList; /** current user's tenant. */ private Tenant currentTenant; /** current user's permissions list. */ private List<String> permissions; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/JobStatisticsVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/JobStatisticsVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** VO of JobStatistics. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class JobStatisticsVO { private Long totalNum; private Long runningNum; private Long finishedNum; private Long canceledNum; private Long failedNum; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/TableVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/TableVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import org.apache.paimon.web.server.data.model.TableColumn; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.util.List; /** VO of table. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class TableVO { private Integer catalogId; private String catalogName; private String databaseName; private String name; private List<TableColumn> columns; private List<String> partitionKey; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/RoleMenuTreeselectVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/RoleMenuTreeselectVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import org.apache.paimon.web.server.data.tree.TreeSelect; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; import java.util.List; /** Role Menu List Tree Vo. */ @Getter public class RoleMenuTreeselectVO { private final List<Integer> checkedKeys; private final List<TreeSelect> menus; public RoleMenuTreeselectVO( @JsonProperty("checkedKeys") List<Integer> checkedKeys, @JsonProperty("menus") List<TreeSelect> menus) { this.checkedKeys = checkedKeys; this.menus = menus; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/OptionVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/OptionVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; /** VO of metadata table option. */ @Data @NoArgsConstructor @AllArgsConstructor public class OptionVO { private String key; private String value; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/SchemaVO.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/vo/SchemaVO.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.vo; import org.apache.paimon.web.server.data.model.MetadataFieldsModel; import org.apache.paimon.web.server.data.model.MetadataOptionModel; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.time.LocalDateTime; import java.util.List; /** VO of metadata schema. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class SchemaVO { private Long schemaId; private List<MetadataFieldsModel> fields; private String partitionKeys; private String primaryKeys; private String comment; private List<MetadataOptionModel> option; private LocalDateTime updateTime; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/tree/TreeSelect.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/tree/TreeSelect.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.tree; import org.apache.paimon.web.server.data.model.SysMenu; import com.fasterxml.jackson.annotation.JsonInclude; import java.io.Serializable; import java.util.List; import java.util.stream.Collectors; /** Treeselect model. */ public class TreeSelect implements Serializable { private static final long serialVersionUID = 1L; /** node ID. */ private Integer id; /** node name. */ private String label; /** children node. */ @JsonInclude(JsonInclude.Include.NON_EMPTY) private List<TreeSelect> children; public TreeSelect() {} public TreeSelect(SysMenu menu) { this.id = menu.getId(); this.label = menu.getMenuName(); this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public List<TreeSelect> getChildren() { return children; } public void setChildren(List<TreeSelect> children) { this.children = children; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/enums/CatalogMode.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/enums/CatalogMode.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.enums; /** Enum representing different catalog modes. */ public enum CatalogMode { FILESYSTEM("filesystem"), HIVE("hive"); private final String mode; CatalogMode(String mode) { this.mode = mode; } public String getMode() { return mode; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/enums/UserType.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/enums/UserType.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.enums; import com.baomidou.mybatisplus.annotation.EnumValue; /** User type. */ public enum UserType { /** ldap user. */ LDAP(1, "LDAP"), /** local user. */ LOCAL(0, "LOCAL"); @EnumValue private final int code; private final String type; public int getCode() { return this.code; } public String getType() { return this.type; } UserType(int code, String type) { this.code = code; this.type = type; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/data/enums/MenuType.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/data/enums/MenuType.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.data.enums; /** menu type enum. */ public enum MenuType { /** directory. */ DIR("M"), /** menu. */ MENU("C"), /** button. */ BUTTON("F"), ; private final String type; MenuType(String type) { this.type = type; } public String getType() { return this.type; } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/validator/PhoneNumberValidator.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/validator/PhoneNumberValidator.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.validator; import org.apache.paimon.shade.org.apache.commons.lang3.StringUtils; import org.apache.paimon.web.server.validator.annotation.PhoneNumber; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; /** * A validator implementation for checking the validity of phone numbers. * * <p>This class is designed to validate strings against common phone number formats. It is used in * conjunction with the {@code @PhoneNumber} annotation to ensure that fields or method parameters * annotated with it adhere to acceptable phone number patterns. */ public class PhoneNumberValidator implements ConstraintValidator<PhoneNumber, String> { @Override public boolean isValid( String phoneNumber, ConstraintValidatorContext constraintValidatorContext) { if (StringUtils.isBlank(phoneNumber)) { return true; } return phoneNumber.matches( "^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$"); } }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/validator/annotation/PhoneNumber.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/validator/annotation/PhoneNumber.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.validator.annotation; import org.apache.paimon.web.server.validator.PhoneNumberValidator; import javax.validation.Constraint; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * Custom validation annotation to ensure that the annotated field or method parameter conforms to a * valid phone number format. This annotation is processed by the {@link PhoneNumberValidator} class * which implements the actual validation logic. * * @see PhoneNumberValidator */ @Documented @Constraint(validatedBy = PhoneNumberValidator.class) @Target({ElementType.FIELD, ElementType.PARAMETER}) @Retention(RUNTIME) public @interface PhoneNumber { String message() default "invalid.phone.format"; Class[] groups() default {}; Class[] payload() default {}; }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/mapper/UserRoleMapper.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/mapper/UserRoleMapper.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.mapper; import org.apache.paimon.web.server.data.model.UserRole; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; /** User Role Mapper. */ @Mapper public interface UserRoleMapper extends BaseMapper<UserRole> { /** * Delete user and role associations by user ID. * * @param userId user ID * @return result */ int deleteUserRoleByUserId(Integer userId); /** * Batch delete user and role associations by user IDs. * * @param ids user IDs * @return result */ int deleteUserRole(Integer[] ids); /** * Query the number of roles used by role ID. * * @param roleId role ID * @return result */ int countUserRoleByRoleId(Integer roleId); /** * Batch Add User Role Information. * * @param userRoleList user-role list * @return result */ int batchUserRole(List<UserRole> userRoleList); /** * Delete user-role association information. * * @param userRole user-role association * @return result */ int deleteUserRoleInfo(UserRole userRole); /** * Batch Unauthorization of User Roles. * * @param roleId role ID * @param userIds user IDs * @return result */ int deleteUserRoleInfos(@Param("roleId") Integer roleId, @Param("userIds") Integer[] userIds); }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false
apache/paimon-webui
https://github.com/apache/paimon-webui/blob/ef0db0b0189c2aa4f47056543fdb063120868ec2/paimon-web-server/src/main/java/org/apache/paimon/web/server/mapper/UserMapper.java
paimon-web-server/src/main/java/org/apache/paimon/web/server/mapper/UserMapper.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.web.server.mapper; import org.apache.paimon.web.server.data.dto.RoleWithUserDTO; import org.apache.paimon.web.server.data.dto.UserWithRolesDTO; import org.apache.paimon.web.server.data.model.User; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; /** User table mapper. */ @Mapper public interface UserMapper extends BaseMapper<User> { /** * Query user list. * * @param user query params * @param page paging params * @return user list */ List<UserWithRolesDTO> listUsers(IPage<User> page, @Param("user") User user); /** * Query user list by role ID. * * @param page paging params * @param roleWithUserDTO query params * @return user list */ List<User> selectAllocatedList( IPage<RoleWithUserDTO> page, @Param("role") RoleWithUserDTO roleWithUserDTO); /** * Query the list of unassigned user roles. * * @param page paging params * @param roleWithUserDTO query params * @return user list */ List<User> selectUnallocatedList( IPage<RoleWithUserDTO> page, @Param("role") RoleWithUserDTO roleWithUserDTO); /** * Query user info by username. * * @param username username * @return user info */ User selectUserByUserName(String username); /** * Retrieves a user along with their roles based on the user's ID. * * @param userId the ID of the user to retrieve * @return the UserWithRolesDTO containing user and role information */ UserWithRolesDTO selectUserWithRolesById(Integer userId); }
java
Apache-2.0
ef0db0b0189c2aa4f47056543fdb063120868ec2
2026-01-05T02:42:23.250368Z
false