├── README.md └── src ├── test └── java │ └── org │ └── openpaas │ └── paasta │ └── portal │ └── api │ ├── cloudfoundry │ ├── operations │ │ ├── LogsReLogsRequest.java │ │ ├── Routes.java │ │ ├── Organization.java │ │ ├── Common.java │ │ └── Applications.java │ └── Connection.java │ ├── datasource │ ├── Common.java │ └── cc │ │ └── SpaceTest.java │ ├── etc │ └── etc.java │ ├── reactor │ ├── MonoTests.java │ └── FluxTests.java │ └── service │ ├── SpaceServiceTest.java │ ├── AppServiceTest.java │ └── Common.java └── main ├── java └── org │ └── openpaas │ └── paasta │ └── portal │ └── api │ ├── config │ ├── datasource │ │ ├── surport │ │ │ ├── Cc.java │ │ │ ├── Uaa.java │ │ │ └── Portal.java │ │ ├── MyBatisConfig.java │ │ └── DataConfig.java │ ├── cloudfoundry │ │ ├── provider │ │ │ └── TokenGrantTokenProvider.java │ │ └── CloudfoundryConfig.java │ ├── GlusterfsConfig.java │ └── security │ │ └── SecurityConfig.java │ ├── mapper │ ├── cc │ │ ├── SpaceMapper.java │ │ ├── OrgMapper.java │ │ ├── CatalogCcMapper.java │ │ └── AdminMainCcMapper.java │ ├── portal │ │ ├── ConfigInfoMapper.java │ │ ├── AppAutoScaleModalMapper.java │ │ ├── WebIdeUserMapper.java │ │ ├── UserManagementMapper.java │ │ ├── SupportNoticeMapper.java │ │ ├── DocumentsMapper.java │ │ ├── MyQuestionMapper.java │ │ ├── MenuMapper.java │ │ ├── SupportQnAMapper.java │ │ ├── LoginMapper.java │ │ ├── SupportBoardMapper.java │ │ ├── CommonCodeMapper.java │ │ ├── QuestionMapper.java │ │ ├── UserDetailMapper.java │ │ └── CatalogMapper.java │ └── uaa │ │ └── UserMapper.java │ ├── service │ ├── CommonService.java │ ├── OrganizationService.java │ ├── AppService.java │ └── SpaceService.java │ ├── model │ ├── Client.java │ ├── ConfigInfo.java │ ├── BuildPack.java │ ├── WebIdeUser.java │ ├── ServiceBroker.java │ ├── Quota.java │ ├── AdminMain.java │ ├── Org.java │ ├── AppAutoScale.java │ ├── Entity.java │ ├── Service.java │ ├── Question.java │ ├── UserDetail.java │ ├── Space.java │ ├── UserManagement.java │ ├── Menu.java │ ├── Usage.java │ ├── MyQuestion.java │ └── CommonCode.java │ ├── Application.java │ └── controller │ ├── EurekaController.java │ ├── BaseController.java │ ├── SpaceController.java │ └── AppController.java └── resources ├── mapper ├── postgresql │ ├── cc │ │ ├── SpaceMapper.xml │ │ ├── CatalogCcMapper.xml │ │ ├── OrgMapper.xml │ │ └── AdminMainCcMapper.xml │ ├── uaa │ │ └── UserMapper.xml │ └── portal │ │ ├── ConfigInfoMapper.xml │ │ ├── LoginMapper.xml │ │ ├── WebIdeUserMapper.xml │ │ ├── QuestionMapper.xml │ │ ├── UserManagementMapper.xml │ │ ├── MyQuestionMapper.xml │ │ ├── AppAutoScaleModalMapper.xml │ │ ├── MenuMapper.xml │ │ ├── UserDetailMapper.xml │ │ └── SupportQnAMapper.xml └── mysql │ ├── cc │ ├── CatalogCcMapper.xml │ └── AdminMainCcMapper.xml │ └── portal │ ├── ConfigInfoMapper.xml │ ├── LoginMapper.xml │ ├── WebIdeUserMapper.xml │ ├── QuestionMapper.xml │ ├── UserManagementMapper.xml │ ├── MyQuestionMapper.xml │ ├── AppAutoScaleModalMapper.xml │ ├── MenuMapper.xml │ └── UserDetailMapper.xml └── application.yml /README.md: -------------------------------------------------------------------------------- 1 | # PAAS-TA-PORTAL-API-V2 2 | v2.0 3 | 4 | ## 유의사항 5 | - gradle 2.14 버전 6 | - java 1.8 버전 7 | -------------------------------------------------------------------------------- /src/test/java/org/openpaas/paasta/portal/api/cloudfoundry/operations/LogsReLogsRequest.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.cloudfoundry.operations; 2 | 3 | /** 4 | * Created by ijlee on 2016-10-24. 5 | */ 6 | public class LogsReLogsRequest { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/config/datasource/surport/Cc.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.config.datasource.surport; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * @author mingu 7 | * 8 | */ 9 | 10 | @Target(ElementType.TYPE) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Documented 13 | public @interface Cc { 14 | 15 | } -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/config/datasource/surport/Uaa.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.config.datasource.surport; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * @author mingu 7 | * 8 | */ 9 | 10 | @Target(ElementType.TYPE) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Documented 13 | public @interface Uaa { 14 | 15 | } -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/config/datasource/surport/Portal.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.config.datasource.surport; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * @author mingu 7 | * 8 | */ 9 | 10 | @Target(ElementType.TYPE) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Documented 13 | public @interface Portal { 14 | 15 | } -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/cc/SpaceMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.cc; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Cc; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by Dojun on 2016-09-06. 9 | */ 10 | @Cc 11 | public interface SpaceMapper { 12 | 13 | List getSpacesForAdmin(int orgId); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/cc/OrgMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.cc; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Cc; 4 | 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | /** 9 | * Created by Dojun on 2016-09-06. 10 | */ 11 | @Cc 12 | public interface OrgMapper { 13 | 14 | List getOrgsForAdmin(); 15 | 16 | Map selectOrg(String orgName); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/portal/ConfigInfoMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.portal; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Portal; 4 | import org.openpaas.paasta.portal.api.model.ConfigInfo; 5 | 6 | import java.util.List; 7 | 8 | @Portal 9 | public interface ConfigInfoMapper { 10 | 11 | List getValue(ConfigInfo configInfo); 12 | 13 | int updateValue(ConfigInfo configInfo); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/cc/CatalogCcMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.cc; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Cc; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * org.openpaas.paasta.portal.api.cc.mapper 9 | * 10 | * @author 김도준 11 | * @version 1.0 12 | * @since 2016.09.01 13 | */ 14 | @Cc 15 | public interface CatalogCcMapper { 16 | 17 | int getDomainId(String domainName); 18 | 19 | List getRouteHostNameList(int domainId); 20 | } 21 | -------------------------------------------------------------------------------- /src/test/java/org/openpaas/paasta/portal/api/datasource/Common.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.datasource; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.openpaas.paasta.portal.api.Application; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 7 | 8 | /** 9 | * Created by mg on 2016-10-18. 10 | */ 11 | @RunWith(SpringJUnit4ClassRunner.class) 12 | @SpringBootTest(classes = Application.class) 13 | public class Common { 14 | 15 | 16 | } -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/portal/AppAutoScaleModalMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.portal; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Portal; 4 | 5 | import java.util.HashMap; 6 | 7 | @Portal 8 | public interface AppAutoScaleModalMapper { 9 | 10 | HashMap getAppAutoScaleInfo(String guid); 11 | 12 | int insertAppAutoScale(HashMap appAutoScale); 13 | 14 | int updateAppAutoScale(HashMap appAutoScale); 15 | 16 | int deleteAppAutoScale(String guid); 17 | } 18 | -------------------------------------------------------------------------------- /src/test/java/org/openpaas/paasta/portal/api/etc/etc.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.etc; 2 | 3 | import org.junit.Test; 4 | 5 | import java.sql.Timestamp; 6 | 7 | /** 8 | * Created by mg on 2016-08-16. 9 | */ 10 | public class etc { 11 | 12 | @Test 13 | public void timestamp() { 14 | Long timestamp = 1471323748499767124L/1000000;//767124 15 | 16 | Long currentTs = System.currentTimeMillis(); 17 | 18 | Timestamp ts = new Timestamp(timestamp); 19 | 20 | ts.setTime(timestamp); 21 | 22 | System.out.println(ts.toLocalDateTime()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/org/openpaas/paasta/portal/api/reactor/MonoTests.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.reactor; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 6 | import reactor.core.publisher.Mono; 7 | 8 | /** 9 | * Created by mg on 2016-08-04. 10 | */ 11 | @RunWith(SpringJUnit4ClassRunner.class) 12 | public class MonoTests { 13 | 14 | @Test 15 | public void subscribe() { 16 | Mono result = Mono.just("just subscribe"); 17 | result.subscribe(x -> System.out.println("result=" + x)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/portal/WebIdeUserMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.portal; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Portal; 4 | import org.openpaas.paasta.portal.api.model.WebIdeUser; 5 | 6 | import java.util.List; 7 | 8 | @Portal 9 | public interface WebIdeUserMapper { 10 | 11 | WebIdeUser getUser(WebIdeUser webIdeUser); 12 | 13 | int insertUser(WebIdeUser webIdeUser); 14 | 15 | int updateUser(WebIdeUser webIdeUser); 16 | 17 | int deleteUser(WebIdeUser webIdeUser); 18 | 19 | List getList(WebIdeUser webIdeUser); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/portal/UserManagementMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.portal; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Portal; 4 | import org.openpaas.paasta.portal.api.model.UserManagement; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * org.openpaas.paasta.portal.api.mapper 10 | * 11 | * @author 김도준 12 | * @version 1.0 13 | * @since 2016.08.31 14 | */ 15 | @Portal 16 | public interface UserManagementMapper { 17 | 18 | List getUserInfoList(UserManagement param); 19 | 20 | int updateOperatingAuthority(UserManagement param); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/portal/SupportNoticeMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.portal; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Portal; 4 | import org.openpaas.paasta.portal.api.model.Support; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by YJKim on 2016-07-28. 10 | */ 11 | @Portal 12 | public interface SupportNoticeMapper { 13 | List getNoticeList(Support param); 14 | Support getNotice(Support param); 15 | int insertNotice(Support param); 16 | int updateNotice(Support param); 17 | int deleteNotice(Support param); 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/cc/AdminMainCcMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.cc; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Cc; 4 | import org.openpaas.paasta.portal.api.model.AdminMain; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * org.openpaas.paasta.portal.api.mapper.cc 10 | * 11 | * @author 김도준 12 | * @version 1.0 13 | * @since 2016.09.08 14 | */ 15 | @Cc 16 | public interface AdminMainCcMapper { 17 | 18 | List getTotalCountList(AdminMain param); 19 | 20 | List getTotalOrganizationList(AdminMain param); 21 | 22 | List getTotalSpaceList(AdminMain param); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/portal/DocumentsMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.portal; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Portal; 4 | import org.openpaas.paasta.portal.api.model.Support; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by YJKim on 2016-07-28. 10 | */ 11 | @Portal 12 | public interface DocumentsMapper { 13 | List getDocumentsList(Support param); 14 | List getDocumentsListUser(Support param); 15 | Support getDocument(Support param); 16 | int insertDocument(Support param); 17 | int updateDocument(Support param); 18 | int deleteDocument(Support param); 19 | 20 | } 21 | 22 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/portal/MyQuestionMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.portal; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Portal; 4 | import org.openpaas.paasta.portal.api.model.MyQuestion; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * org.openpaas.paasta.portal.api.mapper 10 | * 11 | * @author 김도준 12 | * @version 1.0 13 | * @since 2016.08.22 14 | */ 15 | @Portal 16 | public interface MyQuestionMapper { 17 | 18 | List getMyQuestionList(MyQuestion param); 19 | 20 | int insertMyQuestion(MyQuestion param); 21 | 22 | int updateMyQuestion(MyQuestion param); 23 | 24 | int deleteMyQuestion(MyQuestion param); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/config/cloudfoundry/provider/TokenGrantTokenProvider.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.config.cloudfoundry.provider; 2 | 3 | import org.cloudfoundry.reactor.ConnectionContext; 4 | import org.cloudfoundry.reactor.TokenProvider; 5 | import reactor.core.publisher.Mono; 6 | 7 | /** 8 | * Created by mg on 2016-08-09. 9 | */ 10 | public class TokenGrantTokenProvider implements TokenProvider{ 11 | 12 | private String token; 13 | 14 | public TokenGrantTokenProvider(String token) { 15 | this.token = token; 16 | } 17 | 18 | @Override 19 | public Mono getToken(ConnectionContext connectionContext) { 20 | 21 | return Mono.just(token); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/service/CommonService.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.service; 2 | 3 | import org.cloudfoundry.operations.DefaultCloudFoundryOperations; 4 | import org.cloudfoundry.reactor.client.ReactorCloudFoundryClient; 5 | import org.cloudfoundry.reactor.doppler.ReactorDopplerClient; 6 | import org.cloudfoundry.reactor.uaa.ReactorUaaClient; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | 9 | /** 10 | * Created by mg on 2016-10-19. 11 | */ 12 | public class CommonService { 13 | @Autowired 14 | ReactorCloudFoundryClient cloudFoundryClient; 15 | @Autowired 16 | ReactorUaaClient uaaClient; 17 | // @Autowired 18 | // ReactorDopplerClient reactorDopplerClient; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/portal/MenuMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.portal; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Portal; 4 | import org.openpaas.paasta.portal.api.model.Menu; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * org.openpaas.paasta.portal.api.mapper 10 | * 11 | * @author 김도준 12 | * @version 1.0 13 | * @since 2016.09.29 14 | */ 15 | @Portal 16 | public interface MenuMapper { 17 | 18 | int getMenuMaxNoList(Menu param); 19 | 20 | List getMenuList(Menu param); 21 | 22 | List getMenuDetail(Menu param); 23 | 24 | int insertMenu(Menu param); 25 | 26 | int updateMenu(Menu param); 27 | 28 | int deleteMenu(Menu param); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/portal/SupportQnAMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.portal; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Portal; 4 | import org.openpaas.paasta.portal.api.model.Support; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by YJKim on 2016-07-28. 10 | */ 11 | @Portal 12 | public interface SupportQnAMapper { 13 | List getQnAList(Support param); 14 | 15 | Support getQuestion(Support param); 16 | Support getAnswer(Support param); 17 | 18 | int insertAnswer(Support param); 19 | int updateAnswer(Support param); 20 | int deleteAnswer(Support param); 21 | 22 | int updateQuestionStatus(Support param); 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/portal/LoginMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.portal; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Cc; 4 | import org.openpaas.paasta.portal.api.model.App; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Login Mapper 10 | * 11 | * @author nawkm 12 | * @version 1.0 13 | * @since 2016.4.4 최초작성 14 | */ 15 | @Cc 16 | public interface LoginMapper { 17 | 18 | /** 19 | * 총 사용자 수 조회 20 | * 21 | * @return int getTotalUserCount() 22 | */ 23 | int getTotalUserCount(); 24 | 25 | /** 26 | * Gets list apps. 27 | * 28 | * @param userid the userid 29 | * @return the list apps 30 | */ 31 | List getListApps(String userid); 32 | } -------------------------------------------------------------------------------- /src/test/java/org/openpaas/paasta/portal/api/datasource/cc/SpaceTest.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.datasource.cc; 2 | 3 | import org.openpaas.paasta.portal.api.cloudfoundry.operations.Common; 4 | import org.junit.Test; 5 | import org.openpaas.paasta.portal.api.mapper.cc.SpaceMapper; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by mg on 2016-10-18. 12 | */ 13 | public class SpaceTest extends Common { 14 | @Autowired 15 | SpaceMapper spaceMapper; 16 | 17 | @Test 18 | public void getSpaces() { 19 | List s = spaceMapper.getSpacesForAdmin(53); 20 | 21 | s.iterator().forEachRemaining(space -> System.out.println("guid: " + space.toString())); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/mapper/postgresql/cc/SpaceMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/main/resources/mapper/mysql/cc/CatalogCcMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 13 | 14 | 15 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/main/resources/mapper/postgresql/cc/CatalogCcMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 13 | 14 | 15 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/Client.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | /** 4 | * Created by YJKim on 2016-10-10. 5 | */ 6 | public class Client { 7 | 8 | private int pageOffset; 9 | private String clientId; 10 | // private String name; 11 | // private String client_secret; 12 | // private String clientId; 13 | // private String clientId; 14 | // private String clientId;private String clientId; 15 | // private String clientId; 16 | 17 | 18 | 19 | 20 | public int getPageOffset() { 21 | return pageOffset; 22 | } 23 | 24 | public void setPageOffset(int pageOffset) { 25 | this.pageOffset = pageOffset; 26 | } 27 | 28 | public String getClientId() { 29 | return clientId; 30 | } 31 | 32 | public void setClientId(String clientId) { 33 | this.clientId = clientId; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/Application.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | //import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | 8 | /** 9 | * All you need to run a Eureka registration server. 10 | * 11 | * @author Paul Chapman 12 | */ 13 | @SpringBootApplication 14 | @EnableDiscoveryClient 15 | public class Application { 16 | 17 | /** 18 | * Run the application using Spring Boot and an embedded servlet engine. 19 | * 20 | * @param args 21 | * Program arguments - ignored. 22 | */ 23 | public static void main(String[] args) { 24 | // Tell server to look for registration.properties or registration.yml 25 | 26 | SpringApplication.run(Application.class, args); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/resources/mapper/postgresql/uaa/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | UPDATE users SET 9 | username = #{username}, 10 | email = #{username} 11 | WHERE username = #{oldUsername} 12 | 13 | 14 | 19 | 20 | 21 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/test/java/org/openpaas/paasta/portal/api/cloudfoundry/operations/Routes.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.cloudfoundry.operations; 2 | 3 | import org.cloudfoundry.operations.routes.Level; 4 | import org.cloudfoundry.operations.routes.ListRoutesRequest; 5 | import org.cloudfoundry.operations.routes.Route; 6 | import org.junit.Test; 7 | import reactor.core.publisher.Flux; 8 | 9 | /** 10 | * Created by mg on 2016-08-16. 11 | */ 12 | public class Routes extends Common{ 13 | 14 | @Test 15 | public void showRoutes() { 16 | System.out.println(">>> Routes"); 17 | for (Route r : getRoutes().toIterable()) { 18 | System.out.println("FOUND: "+r); 19 | } 20 | System.out.println("<<< Routes"); 21 | } 22 | 23 | 24 | 25 | private Flux getRoutes() { 26 | return cloudFoundryOperations.routes().list(ListRoutesRequest.builder() 27 | .level(Level.SPACE) 28 | .build() 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/resources/mapper/mysql/portal/ConfigInfoMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 18 | 19 | 20 | 21 | UPDATE config_info 22 | SET updated_at = now() 23 | 24 | ,value = #{value} 25 | 26 | WHERE name = #{name} 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/resources/mapper/postgresql/portal/ConfigInfoMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 18 | 19 | 20 | 21 | UPDATE config_info 22 | SET updated_at = now() 23 | 24 | ,value = #{value} 25 | 26 | WHERE name = #{name} 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/ConfigInfo.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | /** 4 | * Web Ide 모델 5 | * 6 | * @author nawkm 7 | * @version 1.0 8 | * @since 2016.8.30 최초작성 9 | */ 10 | public class ConfigInfo { 11 | private String name; 12 | private String value; 13 | private String createdAt; 14 | private String updatedAt; 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name; 22 | } 23 | 24 | public String getValue() { 25 | return value; 26 | } 27 | 28 | public void setValue(String value) { 29 | this.value = value; 30 | } 31 | 32 | public String getCreatedAt() { 33 | return createdAt; 34 | } 35 | 36 | public void setCreatedAt(String createdAt) { 37 | this.createdAt = createdAt; 38 | } 39 | 40 | public String getUpdatedAt() { 41 | return updatedAt; 42 | } 43 | 44 | public void setUpdatedAt(String updatedAt) { 45 | this.updatedAt = updatedAt; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/portal/SupportBoardMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.portal; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Portal; 4 | import org.openpaas.paasta.portal.api.model.Support; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by YJKim on 2016-07-28. 10 | */ 11 | @Portal 12 | public interface SupportBoardMapper { 13 | List getBoardList(Support param); 14 | List getBoardCommentList(Support param); 15 | Support getBoard(Support param); 16 | // Support getBoardCommentNum(Support param); 17 | 18 | int insertBoard(Support param); 19 | int setGroupNo(Support param); 20 | int updateBoard(Support param); 21 | 22 | Support getReplyNum(Support param); 23 | int deleteBoard(Support param); 24 | int deleteAllComments(Support param); 25 | 26 | 27 | int insertBoardComment(Support param); 28 | int setCommentGroupNo(Support param); 29 | int updateBoardComment(Support param); 30 | 31 | Support getCommentReplyNum(Support param); 32 | int deleteBoardComment(Support param); 33 | 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/main/resources/mapper/mysql/portal/LoginMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/resources/mapper/postgresql/portal/LoginMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/controller/EurekaController.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RequestMethod; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | /** 11 | * Created by mg on 2016-10-10. 12 | */ 13 | @RestController 14 | @RequestMapping(value = {""}) 15 | public class EurekaController { 16 | 17 | @RequestMapping(value = "/info", method = RequestMethod.GET) 18 | public Map getInfo() { 19 | HashMap result = new HashMap<>(); 20 | result.put("name", "portal-api"); 21 | result.put("version", 2.0); 22 | result.put("description", "cloudfoundry Api, paasta"); 23 | 24 | return result; 25 | } 26 | 27 | @RequestMapping(value = "/health", method = RequestMethod.GET) 28 | public Map getHealth() { 29 | HashMap result = new HashMap<>(); 30 | result.put("status", "UP"); 31 | 32 | return result; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/portal/CommonCodeMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.portal; 2 | 3 | import org.openpaas.paasta.portal.api.config.datasource.surport.Portal; 4 | import org.openpaas.paasta.portal.api.model.CommonCode; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * org.openpaas.paasta.portal.api.mapper 10 | * 11 | * @author 김도준 12 | * @version 1.0 13 | * @since 2016.06.15 14 | */ 15 | @Portal 16 | public interface CommonCodeMapper { 17 | 18 | List getCommonCodeById(CommonCode param); 19 | 20 | List getCommonCodeGroup(CommonCode param); 21 | 22 | int getCommonCodeGroupCount(CommonCode param); 23 | 24 | List getCommonCodeDetail(CommonCode param); 25 | 26 | int getCommonCodeDetailCount(CommonCode param); 27 | 28 | int insertCommonCodeGroup(CommonCode param); 29 | 30 | int insertCommonCodeDetail(CommonCode param); 31 | 32 | int updateCommonCodeGroup(CommonCode commonCode); 33 | 34 | int updateCommonCodeDetail(CommonCode commonCode); 35 | 36 | int deleteCommonCodeGroup(CommonCode param); 37 | 38 | int deleteCommonCodeDetail(CommonCode param); 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/service/OrganizationService.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.service; 2 | 3 | import org.cloudfoundry.client.CloudFoundryClient; 4 | import org.cloudfoundry.client.v2.organizations.ListOrganizationsRequest; 5 | import org.cloudfoundry.client.v2.organizations.OrganizationResource; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * Created by mg on 2016-10-25. 14 | */ 15 | @Service 16 | public class OrganizationService { 17 | private static final Logger LOGGER = LoggerFactory.getLogger(OrganizationService.class); 18 | 19 | public String getOrganizationId(CloudFoundryClient cloudFoundryClient, String organizationName) { 20 | LOGGER.info("Get Organization Id: organizationName={}", organizationName); 21 | List organizationList = cloudFoundryClient.organizations().list(ListOrganizationsRequest.builder().name(organizationName).build()).block().getResources(); 22 | 23 | LOGGER.info("Get OrganizationId: Result size={}", organizationList.size()); 24 | return organizationList.get(0).getMetadata().getId(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/resources/mapper/postgresql/cc/OrgMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 18 | 19 | 31 | 32 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/uaa/UserMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.uaa; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import org.cloudfoundry.identity.uaa.scim.ScimUser; 5 | import org.openpaas.paasta.portal.api.config.datasource.surport.Uaa; 6 | 7 | /** 8 | * Login Mapper 9 | * 10 | * @author mingu 11 | * @version 1.0 12 | * @since 2016.5.18 최초작성 13 | */ 14 | @Uaa 15 | public interface UserMapper { 16 | /** 17 | * update User's email and username 18 | * 19 | * @param oldUsername the old username 20 | * @param username the username 21 | * @return int int 22 | */ 23 | int updateUserNameAndEmail(@Param("oldUsername") String oldUsername, @Param("username") String username); 24 | 25 | 26 | /** 27 | * check user 28 | * 29 | * @param username the username 30 | * @return int int 31 | */ 32 | int isExist(@Param("username") String username); 33 | 34 | 35 | ScimUser createUser(org.cloudfoundry.identity.uaa.scim.ScimUser user, String password); 36 | 37 | 38 | /** 39 | * Gets user guid. 40 | * 41 | * @param username the username (=) user id 42 | * @return user guid 43 | */ 44 | String getUserGuid(String username); 45 | } -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/portal/QuestionMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.portal; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import org.openpaas.paasta.portal.api.config.datasource.surport.Portal; 5 | import org.openpaas.paasta.portal.api.model.Question; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Login Mapper 11 | * 12 | * @author kimdojun 13 | * @version 1.0 14 | * @since 2016.6.7 최초작성 15 | */ 16 | @Portal 17 | public interface QuestionMapper { 18 | 19 | 20 | /** 21 | * 22 | * update question 23 | * 24 | * @param question 25 | * @return 26 | */ 27 | boolean updateMyQuestion(@Param("question") Question question); 28 | 29 | 30 | /** 31 | * insert question 32 | * 33 | * @param question 34 | * @return 35 | */ 36 | boolean insertQuestion(@Param("question") Question question); 37 | 38 | /** 39 | * get my questions 40 | * 41 | * @param userId 42 | * @return List 43 | */ 44 | List getMyQuestions(String userId); 45 | 46 | 47 | /** 48 | * delete my question 49 | * 50 | * @param question 51 | * @return 52 | */ 53 | boolean deleteMyQuestion(@Param("question") Question question); 54 | } -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/BuildPack.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | import java.util.UUID; 4 | 5 | /** 6 | * Web Ide 모델 7 | * 8 | * @author nawkm 9 | * @version 1.0 10 | * @since 2016.8.30 최초작성 11 | */ 12 | public class BuildPack { 13 | private UUID guid; 14 | private String name; 15 | private int position; 16 | private boolean enable; 17 | private boolean lock; 18 | 19 | public UUID getGuid() { 20 | return guid; 21 | } 22 | 23 | public void setGuid(UUID guid) { 24 | this.guid = guid; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | public int getPosition() { 36 | return position; 37 | } 38 | 39 | public void setPosition(int position) { 40 | this.position = position; 41 | } 42 | 43 | public boolean getEnable() { 44 | return enable; 45 | } 46 | 47 | public void setEnable(boolean enable) { 48 | this.enable = enable; 49 | } 50 | 51 | public boolean getLock() { 52 | return lock; 53 | } 54 | 55 | public void setLock(boolean lock) { 56 | this.lock = lock; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/WebIdeUser.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | /** 4 | * Web Ide 모델 5 | * 6 | * @author nawkm 7 | * @version 1.0 8 | * @since 2016.8.30 최초작성 9 | */ 10 | public class WebIdeUser { 11 | private String userId; 12 | private String orgName; 13 | private String url; 14 | private String useYn; 15 | private String createdAt; 16 | private String updatedAt; 17 | 18 | public String getUserId() { 19 | return userId; 20 | } 21 | 22 | public void setUserId(String userId) { 23 | this.userId = userId; 24 | } 25 | 26 | public String getOrgName() { 27 | return orgName; 28 | } 29 | 30 | public void setOrgName(String orgName) { 31 | this.orgName = orgName; 32 | } 33 | 34 | public String getUrl() { 35 | return url; 36 | } 37 | 38 | public void setUrl(String url) { 39 | this.url = url; 40 | } 41 | 42 | public String getUseYn() { 43 | return useYn; 44 | } 45 | 46 | public void setUseYn(String useYn) { 47 | this.useYn = useYn; 48 | } 49 | 50 | public String getCreatedAt() { 51 | return createdAt; 52 | } 53 | 54 | public void setCreatedAt(String createdAt) { 55 | this.createdAt = createdAt; 56 | } 57 | 58 | public String getUpdatedAt() { 59 | return updatedAt; 60 | } 61 | 62 | public void setUpdatedAt(String updatedAt) { 63 | this.updatedAt = updatedAt; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/test/java/org/openpaas/paasta/portal/api/cloudfoundry/operations/Organization.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.cloudfoundry.operations; 2 | 3 | import org.cloudfoundry.operations.organizations.OrganizationSummary; 4 | import org.junit.Test; 5 | import reactor.core.publisher.Flux; 6 | import reactor.core.publisher.Mono; 7 | 8 | /** 9 | * Created by mg on 2016-08-16. 10 | */ 11 | public class Organization extends Common{ 12 | 13 | private Mono organizationId = Mono.just("bd-org"); 14 | 15 | @Test 16 | public void showOrganizations() { 17 | 18 | System.out.println(">>> Show Organizations"); 19 | 20 | for (OrganizationSummary organization : getOrganizations().toIterable()) { 21 | System.out.println(organization); 22 | } 23 | 24 | System.out.println("<<< Show Organizations"); 25 | } 26 | 27 | @Test 28 | public void showOrganizations2() { 29 | System.out.println(">>> Show Organizations2"); 30 | 31 | Flux orgs = getOrganizations().cache(); 32 | System.out.println("Orgs Count="+orgs.count().block()); 33 | 34 | orgs 35 | .subscribe( o -> System.out.println("FOUND Organization : " + o) ); 36 | //.subscribe( a -> System.out.println("Apps Name: " + a.getName()) ); 37 | 38 | System.out.println("<<< Show Organizations2"); 39 | 40 | } 41 | 42 | private Flux getOrganizations() { 43 | return cloudFoundryOperations.organizations() 44 | .list(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/controller/BaseController.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.controller; 2 | 3 | import org.cloudfoundry.client.CloudFoundryClient; 4 | import org.cloudfoundry.doppler.DopplerClient; 5 | import org.cloudfoundry.operations.CloudFoundryOperations; 6 | import org.cloudfoundry.reactor.ConnectionContext; 7 | import org.cloudfoundry.reactor.TokenProvider; 8 | import org.cloudfoundry.uaa.UaaClient; 9 | import org.openpaas.paasta.portal.api.util.CfUtils; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.beans.factory.annotation.Qualifier; 12 | 13 | /** 14 | * Created by mg on 2016-10-21. 15 | */ 16 | public class BaseController { 17 | protected static final String AUTHORIZATION_HEADER_KEY="cf-Authorization"; 18 | 19 | @Autowired 20 | @Qualifier("connectionContext") 21 | ConnectionContext connectionContext; 22 | @Autowired 23 | @Qualifier("tokenProvider") 24 | TokenProvider adminTokenProvider; 25 | @Autowired 26 | @Qualifier("dopplerClient") 27 | DopplerClient adminDopplerClient; 28 | @Autowired 29 | @Qualifier("uaaClient") 30 | UaaClient adminUaaClient; 31 | @Autowired 32 | @Qualifier("cloudFoundryClient") 33 | CloudFoundryClient adminCloudFoundryClient; 34 | 35 | protected CloudFoundryOperations getAdminCloudFoundryOperations(String organization, String space) { 36 | return CfUtils.cloudFoundryOperations(adminCloudFoundryClient, adminDopplerClient, adminUaaClient, organization, space); 37 | } 38 | 39 | protected TokenProvider getTokenProvider(String token) { 40 | return CfUtils.tokenProvider(token); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # Spring properties 2 | spring: 3 | application: 4 | name: portal-api-v2 # Service registers under this name 5 | # HTTP Server 6 | server: 7 | port: ${PORT:3333} # HTTP (Tomcat) port 8 | 9 | # CloudFoundry API Url 10 | # CloudFoundry Login information 11 | cf: 12 | apiurl: https://api.115.68.46.186.xip.io 13 | sslSkipValidation: true 14 | clientId: admin 15 | clientSecret: admin-secret 16 | username: admin 17 | password: '!paas_ta202' 18 | 19 | --- 20 | spring: 21 | profiles: local 22 | security: 23 | username: admin 24 | password: openpaasta 25 | datasource: 26 | cc: 27 | driverClassName: org.postgresql.Driver 28 | url: jdbc:postgresql://localhost:5524/ccdb 29 | username: ccadmin 30 | password: admin 31 | portal: 32 | driverClassName: org.postgresql.Driver 33 | url: jdbc:postgresql://localhost:5524/portaldb 34 | username: portaladmin 35 | password: admin 36 | uaa: 37 | driverClassName: org.postgresql.Driver 38 | url: jdbc:postgresql://localhost:5524/uaadb 39 | username: uaaadmin 40 | password: admin 41 | multipart: 42 | maxFileSize: 1000Mb 43 | maxRequestSize: 1000Mb 44 | eureka: 45 | instance: 46 | hostname: localhost 47 | client: 48 | serviceUrl: 49 | defaultZone: http://127.0.0.1:2221/eureka/ 50 | logging: 51 | level: 52 | org.openpaas.paasta.portal.api.mapper: INFO 53 | 54 | 55 | multipart: 56 | maxFileSize: 1000Mb 57 | maxRequestSize: 1000Mb 58 | eureka: 59 | instance: 60 | hostname: ${vcap.application.uris[0]} 61 | nonSecurePort: 80 62 | client: 63 | serviceUrl: 64 | defaultZone: ${vcap.services.portal-eureka-service.credentials.uri}/eureka/ 65 | 66 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/portal/UserDetailMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.portal; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import org.openpaas.paasta.portal.api.config.datasource.surport.Portal; 5 | import org.openpaas.paasta.portal.api.model.UserDetail; 6 | 7 | import java.util.HashMap; 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | * Login Mapper 13 | * 14 | * @author mingu 15 | * @version 1.0 16 | * @since 2016.5.18 최초작성 17 | */ 18 | @Portal 19 | public interface UserDetailMapper { 20 | 21 | /** 22 | * Gets list apps. 23 | * 24 | * @param userId the userid 25 | * @return the list users 26 | */ 27 | UserDetail selectOne(String userId); 28 | 29 | /** 30 | * 31 | * update User Detail 32 | * 33 | * @param userId 34 | * @param userDetail 35 | * @return 36 | */ 37 | int update(@Param("userId") String userId, @Param("userDetail") UserDetail userDetail); 38 | 39 | /** 40 | * 41 | * @param oldUserId 42 | * @param userId 43 | * @return 44 | */ 45 | // int updateUserId(@Param("oldUserId") String oldUserId, @Param("newUserId") String userId); 46 | 47 | /** 48 | * insert User Detail 49 | * 50 | * @param userDetail 51 | * @return 52 | */ 53 | int insert(UserDetail userDetail); 54 | 55 | int delete(@Param("userId") String userId); 56 | 57 | /** 58 | * 총 사용자 수 조회 59 | * 60 | * @return int 61 | */ 62 | int getUserDetailCount(); 63 | 64 | int createRequestUser(Map map); 65 | 66 | List getUserDetailInfo(HashMap map); 67 | 68 | int upadteUserParam(HashMap map); 69 | 70 | } -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/ServiceBroker.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | public class ServiceBroker extends Entity { 4 | private String url; 5 | private String username; 6 | private String password; 7 | private String newName; 8 | 9 | public ServiceBroker(String url, String username) { 10 | this.url = url; 11 | this.username = username; 12 | } 13 | 14 | public ServiceBroker(String url, String username, String password) { 15 | this.url = url; 16 | this.username = username; 17 | this.password = password; 18 | } 19 | 20 | public ServiceBroker(Meta meta, String name, String url, String username) { 21 | super(meta, name); 22 | this.url = url; 23 | this.username = username; 24 | } 25 | 26 | public ServiceBroker(Meta meta, String name, String url, String username, String password) { 27 | super(meta, name); 28 | this.url = url; 29 | this.username = username; 30 | this.password = password; 31 | } 32 | 33 | public String getUrl() { 34 | return url; 35 | } 36 | 37 | public String getUsername() { 38 | return username; 39 | } 40 | 41 | public String getPassword() { 42 | return password; 43 | } 44 | 45 | public void setUrl(String url) { 46 | this.url = url; 47 | } 48 | 49 | public void setUsername(String username) { 50 | this.username = username; 51 | } 52 | 53 | public void setPassword(String password) { 54 | this.password = password; 55 | } 56 | 57 | public String getNewName() { 58 | return newName; 59 | } 60 | 61 | public void setNewName(String newName) { 62 | this.newName = newName; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/config/GlusterfsConfig.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.config; 2 | 3 | /** 4 | * Created by mg on 2016-07-05. 5 | */ 6 | 7 | public class GlusterfsConfig { 8 | 9 | // @Bean 10 | // public AccountConfig accountConfig(@Value("${glusterfs.tenantName}") String tenantName, 11 | // @Value("${glusterfs.username}") String username, 12 | // @Value("${glusterfs.password}") String password, 13 | // @Value("${glusterfs.authUrl}") String authUrl) { 14 | // AccountConfig config = new AccountConfig(); 15 | // config.setUsername(username); 16 | // config.setTenantName(tenantName); 17 | // config.setPassword(password); 18 | // config.setAuthUrl(authUrl + "/tokens"); 19 | // config.setAuthenticationMethod(AuthenticationMethod.KEYSTONE); 20 | // return config; 21 | // } 22 | // 23 | // @Bean 24 | // public AccountFactory accountFactory(AccountConfig accountConfig){ 25 | // return new AccountFactory(accountConfig); 26 | // } 27 | // 28 | // @Bean 29 | // public Account account(AccountFactory accountFactory){ 30 | // return accountFactory.createAccount(); 31 | // } 32 | // 33 | // @Bean 34 | // public Container container(Account account, 35 | // @Value("${glusterfs.containerName}") String containerName) { 36 | // 37 | // Container container = account.getContainer(containerName); 38 | // if(!container.exists()){ 39 | // container.create(); 40 | // container.makePublic(); 41 | // } 42 | // 43 | // return container; 44 | // } 45 | } 46 | -------------------------------------------------------------------------------- /src/test/java/org/openpaas/paasta/portal/api/service/SpaceServiceTest.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.service; 2 | 3 | import org.cloudfoundry.client.CloudFoundryClient; 4 | import org.cloudfoundry.client.v2.CloudFoundryException; 5 | import org.cloudfoundry.operations.DefaultCloudFoundryOperations; 6 | import org.cloudfoundry.reactor.TokenProvider; 7 | import org.cloudfoundry.reactor.client.ReactorCloudFoundryClient; 8 | import org.junit.Assert; 9 | import org.junit.Before; 10 | import org.junit.BeforeClass; 11 | import org.junit.Test; 12 | import org.openpaas.paasta.portal.api.model.Space; 13 | import org.openpaas.paasta.portal.api.util.CfUtils; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | 16 | import java.io.IOException; 17 | 18 | /** 19 | * Created by mg on 2016-10-20. 20 | */ 21 | public class SpaceServiceTest extends Common { 22 | @Autowired 23 | SpaceService spaceService; 24 | @Autowired 25 | OrganizationService organizationService; 26 | 27 | @Test 28 | public void getSpaceSummery() throws IOException { 29 | Space space = new Space(); 30 | space.setOrgName("OCP"); 31 | space.setSpaceName("dev"); 32 | try { 33 | String organizationId = organizationService.getOrganizationId(cloudFoundryClient, space.getOrgName()); 34 | String spaceId = spaceService.getSpaceId(cloudFoundryClient, organizationId, space.getSpaceName()); 35 | Space spaceSummary = spaceService.getSpaceSummery(cloudFoundryClient, spaceId); 36 | 37 | Assert.assertEquals(spaceSummary.getName(), space.getSpaceName()); 38 | } catch (CloudFoundryException cfe) { 39 | 40 | Assert.fail(cfe.getMessage()); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/service/AppService.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.service; 2 | 3 | import org.cloudfoundry.doppler.Envelope; 4 | import org.cloudfoundry.doppler.RecentLogsRequest; 5 | import org.cloudfoundry.operations.DefaultCloudFoundryOperations; 6 | import org.cloudfoundry.operations.applications.ApplicationDetail; 7 | import org.cloudfoundry.operations.applications.ApplicationSummary; 8 | import org.cloudfoundry.operations.applications.GetApplicationRequest; 9 | import org.cloudfoundry.reactor.doppler.ReactorDopplerClient; 10 | import org.springframework.stereotype.Service; 11 | import reactor.core.publisher.Flux; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * 앱 서비스 - 애플리케이션 정보 조회, 구동, 정지 등의 API 를 호출 하는 서비스이다. 17 | * 18 | * @author 조민구 19 | * @version 1.0 20 | * @since 2016.12.4 최초작성 21 | */ 22 | @Service 23 | public class AppService extends CommonService{ 24 | 25 | public List getAppSummery(DefaultCloudFoundryOperations cloudFoundryOperations) { 26 | return cloudFoundryOperations.applications().list().collectList().block(); 27 | } 28 | 29 | public ApplicationDetail getAppDetail(DefaultCloudFoundryOperations cloudFoundryOperations, String appName) { 30 | return cloudFoundryOperations.applications().get( 31 | GetApplicationRequest.builder() 32 | .name(appName).build()) 33 | .block(); 34 | } 35 | 36 | public Flux getRecentLog(ReactorDopplerClient reactorDopplerClient, String appId) { 37 | 38 | RecentLogsRequest recentLogsRequest = RecentLogsRequest.builder() 39 | .applicationId(appId) 40 | .build(); 41 | 42 | Flux getRecentLog = reactorDopplerClient.recentLogs(recentLogsRequest); 43 | 44 | return getRecentLog; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/Quota.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | /** 4 | * 5 | * @author Harry Zhang 6 | * 7 | */ 8 | public class Quota extends Entity { 9 | 10 | private boolean nonBasicServicesAllowed = false; 11 | private int totalServices; 12 | private int totalRoutes; 13 | private int memoryLimit; 14 | 15 | public Quota(){ 16 | } 17 | 18 | public Quota(Meta meta, String name, boolean nonBasicServicesAllowed, 19 | int totalServices, int totalRoutes, int memoryLimit) { 20 | super(meta, name); 21 | this.totalServices=totalServices; 22 | this.totalRoutes=totalRoutes; 23 | this.memoryLimit=memoryLimit; 24 | this.nonBasicServicesAllowed = nonBasicServicesAllowed; 25 | 26 | } 27 | /** 28 | * Default value :"memory_limit":0,"total_routes":0,"total_services":0,"non_basic_services_allowed":false 29 | * 30 | * @param meta 31 | * @param name 32 | */ 33 | public Quota(Meta meta, String name){ 34 | super(meta, name); 35 | } 36 | 37 | public int getTotalServices() { 38 | return totalServices; 39 | } 40 | 41 | public void setTotalServices(int totalServices) { 42 | this.totalServices = totalServices; 43 | } 44 | 45 | public int getTotalRoutes() { 46 | return totalRoutes; 47 | } 48 | 49 | public void setTotalRoutes(int totalRoutes) { 50 | this.totalRoutes = totalRoutes; 51 | } 52 | 53 | public int getMemoryLimit() { 54 | return memoryLimit; 55 | } 56 | 57 | public void setMemoryLimit(int memoryLimit) { 58 | this.memoryLimit = memoryLimit; 59 | } 60 | 61 | public void setNonBasicServicesAllowed(boolean nonBasicServicesAllowed) { 62 | this.nonBasicServicesAllowed = nonBasicServicesAllowed; 63 | } 64 | 65 | public boolean isNonBasicServicesAllowed() { 66 | return nonBasicServicesAllowed; 67 | } 68 | 69 | 70 | } -------------------------------------------------------------------------------- /src/test/java/org/openpaas/paasta/portal/api/cloudfoundry/Connection.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.cloudfoundry; 2 | 3 | import org.cloudfoundry.reactor.TokenProvider; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.openpaas.paasta.portal.api.util.CfUtils; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | 9 | /** 10 | * Created by mg on 2016-08-10. 11 | */ 12 | @RunWith(SpringJUnit4ClassRunner.class) 13 | public class Connection { 14 | 15 | 16 | private static final String TEST_API_HOST = "api.115.68.46.30.xip.io"; 17 | private static final String TEST_USERNAME = "admin"; 18 | private static final String TEST_PASSWORD = "admin"; 19 | private static final String TEST_CLIENT_ID = "cloudfoundry"; 20 | private static final String TEST_CLIENT_SECRET = ""; 21 | private static final String TEST_ORGANIZATION = "OCP"; 22 | private static final String TEST_SPACE = "dev"; 23 | 24 | // private static final String TEST_API_HOST = "api.run.pivotal.io"; 25 | // private static final String TEST_USERNAME = "juhyun@bluedigm.com"; 26 | // private static final String TEST_PASSWORD = "hju8558"; 27 | // private static final String TEST_CLIENT_ID = "cloudfoundry"; 28 | // private static final String TEST_CLIENT_SECRET = ""; 29 | // private static final String TEST_ORGANIZATION = "bd-org"; 30 | // private static final String TEST_SPACE = "test"; 31 | 32 | @Test 33 | public void connection() { 34 | String token = ""; 35 | 36 | 37 | TokenProvider tokenProvider = CfUtils.tokenProvider(TEST_USERNAME, TEST_PASSWORD, TEST_CLIENT_ID, TEST_CLIENT_ID); 38 | 39 | token = tokenProvider.getToken(CfUtils.connectionContext(TEST_API_HOST, true)).block(); 40 | 41 | if ( token == null || "".equals(token) ) System.out.println("token is null."); 42 | else System.out.println("token: " + token); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/test/java/org/openpaas/paasta/portal/api/service/AppServiceTest.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.service; 2 | 3 | import org.cloudfoundry.doppler.Envelope; 4 | import org.cloudfoundry.doppler.RecentLogsRequest; 5 | import org.cloudfoundry.operations.applications.ApplicationDetail; 6 | import org.cloudfoundry.operations.applications.ApplicationSummary; 7 | import org.junit.Test; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import reactor.core.publisher.Flux; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by mg on 2016-10-19. 15 | */ 16 | public class AppServiceTest extends Common { 17 | @Autowired 18 | AppService appService; 19 | 20 | @Test 21 | public void getAppSummery() { 22 | List apps = appService.getAppSummery(cloudFoundryOperations); 23 | 24 | apps.iterator().forEachRemaining(applicationSummary -> System.out.println(applicationSummary)); 25 | } 26 | 27 | @Test 28 | public void getAppDetail() { 29 | String appName = "portal-api"; 30 | ApplicationDetail app = appService.getAppDetail(cloudFoundryOperations, appName); 31 | 32 | System.out.println("app.toString(): > >>>>>>>>>>" + app.toString()); 33 | 34 | } 35 | 36 | /** 37 | * 앱 로그 정보 가져오기(API) 38 | */ 39 | @Test 40 | public void getLog() { 41 | RecentLogsRequest recentLogsRequest = RecentLogsRequest.builder() 42 | .applicationId("portal-api") 43 | .build(); 44 | Flux flux = appService.getRecentLog(reactorDopplerClient, "portal-api"); 45 | System.out.println("app.toString(): > >>>>>>>>>>" + flux.log().cache()); 46 | } 47 | 48 | @Test 49 | public void valid() { 50 | RecentLogsRequest recentLogsRequest = RecentLogsRequest.builder() 51 | .applicationId("portal-api") 52 | .build(); 53 | 54 | System.out.println("recentLogsRequest.recentLogsRequest(): > >>>>>>>>>>" + recentLogsRequest.getApplicationId()); 55 | 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/test/java/org/openpaas/paasta/portal/api/cloudfoundry/operations/Common.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.cloudfoundry.operations; 2 | 3 | import org.cloudfoundry.operations.DefaultCloudFoundryOperations; 4 | import org.cloudfoundry.reactor.ConnectionContext; 5 | import org.cloudfoundry.reactor.TokenProvider; 6 | import org.cloudfoundry.reactor.client.ReactorCloudFoundryClient; 7 | import org.junit.Before; 8 | import org.junit.runner.RunWith; 9 | import org.openpaas.paasta.portal.api.Application; 10 | import org.openpaas.paasta.portal.api.util.CfUtils; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.boot.test.context.SpringBootTest; 13 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 14 | 15 | /** 16 | * Created by mg on 2016-08-16. 17 | */ 18 | 19 | @RunWith(SpringJUnit4ClassRunner.class) 20 | @SpringBootTest(classes = Application.class) 21 | public class Common { 22 | private final String TEST_USERNAME = "admin"; 23 | private final String TEST_PASSWORD = "admin"; 24 | private final String TEST_CLIENT_ID = "cf"; 25 | private final String TEST_CLIENT_SECRET = ""; 26 | private final String TEST_ORGANIZATION = "OCP"; 27 | private final String TEST_SPACE = "dev"; 28 | public TokenProvider tokenProvider; 29 | @Autowired 30 | public ConnectionContext connectionContext; 31 | public ReactorCloudFoundryClient cloudFoundryClient; 32 | public DefaultCloudFoundryOperations cloudFoundryOperations; 33 | 34 | 35 | 36 | 37 | public Common() { 38 | tokenProvider = CfUtils.tokenProvider(TEST_USERNAME, TEST_PASSWORD, TEST_CLIENT_ID, TEST_CLIENT_SECRET); 39 | } 40 | 41 | @Before 42 | public void set(){ 43 | cloudFoundryClient = CfUtils.cloudFoundryClient(connectionContext, tokenProvider); 44 | cloudFoundryOperations = CfUtils.cloudFoundryOperations(connectionContext, tokenProvider, TEST_ORGANIZATION, TEST_SPACE); 45 | } 46 | 47 | // public Applications applications(){ 48 | // return cloudFoundryOperations.applications(); 49 | // } 50 | } 51 | -------------------------------------------------------------------------------- /src/test/java/org/openpaas/paasta/portal/api/reactor/FluxTests.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.reactor; 2 | 3 | import org.cloudfoundry.operations.applications.ApplicationSummary; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 7 | import reactor.core.publisher.Flux; 8 | 9 | /** 10 | * Created by mg on 2016-08-04. 11 | */ 12 | @RunWith(SpringJUnit4ClassRunner.class) 13 | public class FluxTests { 14 | 15 | @Test 16 | public void subscribe() { 17 | Flux flux = Flux.just("just", "subscribe"); 18 | flux.subscribe(x -> System.out.println("result="+x)); 19 | 20 | 21 | Flux apps = Flux.just(ApplicationSummary.builder() 22 | .name("test") 23 | .diskQuota(1111) 24 | .id("asdfasdf") 25 | .instances(1) 26 | .memoryLimit(512) 27 | .requestedState("") 28 | .runningInstances(1) 29 | .build() 30 | , ApplicationSummary.builder() 31 | .name("tset2") 32 | .diskQuota(1111) 33 | .id("asdfasdf") 34 | .instances(1) 35 | .memoryLimit(512) 36 | .requestedState("") 37 | .runningInstances(1) 38 | .build()); 39 | apps.subscribe(x -> System.out.println("app name="+x.getName())); 40 | 41 | 42 | 43 | 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/test/java/org/openpaas/paasta/portal/api/service/Common.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.service; 2 | 3 | import org.cloudfoundry.operations.DefaultCloudFoundryOperations; 4 | import org.cloudfoundry.reactor.ConnectionContext; 5 | import org.cloudfoundry.reactor.TokenProvider; 6 | import org.cloudfoundry.reactor.client.ReactorCloudFoundryClient; 7 | import org.cloudfoundry.reactor.doppler.ReactorDopplerClient; 8 | import org.junit.Before; 9 | import org.junit.runner.RunWith; 10 | import org.openpaas.paasta.portal.api.Application; 11 | import org.openpaas.paasta.portal.api.util.CfUtils; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.boot.test.context.SpringBootTest; 14 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 15 | 16 | /** 17 | * Service를 테스트 하기 위한 기본 클레스 18 | * Created by mg on 2016-10-19. 19 | */ 20 | @RunWith(SpringJUnit4ClassRunner.class) 21 | @SpringBootTest(classes = Application.class) 22 | public class Common { 23 | private final String TEST_USERNAME = "admin"; 24 | private final String TEST_PASSWORD = "admin"; 25 | private final String TEST_CLIENT_ID = "cf"; 26 | private final String TEST_CLIENT_SECRET = ""; 27 | private final String TEST_ORGANIZATION = "OCP"; 28 | private final String TEST_SPACE = "dev"; 29 | @Autowired 30 | public ConnectionContext connectionContext; 31 | public TokenProvider tokenProvider; 32 | public ReactorCloudFoundryClient cloudFoundryClient; 33 | public DefaultCloudFoundryOperations cloudFoundryOperations; 34 | public ReactorDopplerClient reactorDopplerClient; 35 | 36 | 37 | 38 | 39 | public Common() { 40 | tokenProvider = CfUtils.tokenProvider(TEST_USERNAME, TEST_PASSWORD, TEST_CLIENT_ID, TEST_CLIENT_SECRET); 41 | } 42 | 43 | @Before 44 | public void set(){ 45 | cloudFoundryClient = CfUtils.cloudFoundryClient(connectionContext, tokenProvider); 46 | cloudFoundryOperations = CfUtils.cloudFoundryOperations(connectionContext, tokenProvider, TEST_ORGANIZATION, TEST_SPACE); 47 | reactorDopplerClient = CfUtils.dopplerClient(connectionContext, tokenProvider); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/resources/mapper/mysql/portal/WebIdeUserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 20 | INSERT INTO web_ide_user( 21 | user_id 22 | , org_name 23 | , created_at 24 | ) 25 | VALUES ( 26 | #{userId} 27 | , #{orgName} 28 | , now() 29 | ); 30 | 31 | 32 | 33 | 34 | 35 | DELETE FROM web_ide_user 36 | WHERE org_name = #{orgName} 37 | 38 | 39 | 40 | 41 | UPDATE web_ide_user 42 | SET updated_at = now() 43 | 44 | ,url = #{url} 45 | 46 | 47 | ,use_yn = #{useYn} 48 | 49 | 50 | WHERE user_id = #{userId} and 51 | org_name = #{orgName} 52 | 53 | 54 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /src/main/resources/mapper/postgresql/portal/WebIdeUserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 20 | INSERT INTO web_ide_user( 21 | user_id 22 | , org_name 23 | , created_at 24 | ) 25 | VALUES ( 26 | #{userId} 27 | , #{orgName} 28 | , now() 29 | ); 30 | 31 | 32 | 33 | 34 | 35 | DELETE FROM web_ide_user 36 | WHERE org_name = #{orgName} 37 | 38 | 39 | 40 | 41 | UPDATE web_ide_user 42 | SET updated_at = now() 43 | 44 | ,url = #{url} 45 | 46 | 47 | ,use_yn = #{useYn} 48 | 49 | 50 | WHERE user_id = #{userId} and 51 | org_name = #{orgName} 52 | 53 | 54 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/mapper/portal/CatalogMapper.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.mapper.portal; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import org.openpaas.paasta.portal.api.config.datasource.surport.Portal; 5 | import org.openpaas.paasta.portal.api.model.Catalog; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * org.openpaas.paasta.portal.api.mapper 11 | * 12 | * @author 김도준 13 | * @version 1.0 14 | * @since 2016.07.04 15 | */ 16 | @Portal 17 | public interface CatalogMapper { 18 | 19 | List getBuildPackCatalogList(Catalog param); 20 | 21 | List getServicePackCatalogList(Catalog param); 22 | 23 | int getBuildPackCatalogCount(Catalog param); 24 | 25 | int getServicePackCatalogCount(Catalog param); 26 | 27 | int insertBuildPackCatalog(Catalog param); 28 | 29 | int insertServicePackCatalog(Catalog param); 30 | 31 | int updateBuildPackCatalog(Catalog param); 32 | 33 | int updateServicePackCatalog(Catalog param); 34 | 35 | int deleteBuildPackCatalog(Catalog param); 36 | 37 | int deleteServicePackCatalog(Catalog param); 38 | 39 | int getCheckDeleteBuildPackCatalogCount(Catalog param); 40 | 41 | int getCheckDeleteServicePackCatalogCount(Catalog param); 42 | 43 | int getStarterCatalogCount(Catalog param); 44 | 45 | List getStarterNamesList(Catalog param); 46 | 47 | List getBuildPackNamesList(Catalog param); 48 | 49 | List getServicePackNamesList(Catalog param); 50 | 51 | List getSelectedServicePackList(Catalog param); 52 | 53 | Catalog getOneStarterCatalog(Catalog param); 54 | 55 | int getStarterCatalogMaxNumber(); 56 | 57 | int insertStarterCatalog(Catalog param); 58 | 59 | int insertSelectedServicePackList(int selectedServicePackCategoryNoListValue); 60 | 61 | int insertSelectedServicePackListForUpdate(@Param("param") Catalog param, @Param("selectedServicePackCategoryNoListValue") int selectedServicePackCategoryNoListValue); 62 | 63 | int updateStarterCatalog(@Param("param") Catalog param); 64 | 65 | int deleteStarterCatalog(Catalog param); 66 | 67 | int deleteSelectedServicePackList(Catalog param); 68 | 69 | List getCatalogHistoryList(Catalog param); 70 | 71 | void insertCatalogHistory(Catalog param); 72 | 73 | List getCatalogStarterRelationBuildPackList(Catalog param); 74 | 75 | List getCatalogStarterRelationServicePackList(Catalog param); 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/config/cloudfoundry/CloudfoundryConfig.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.config.cloudfoundry; 2 | 3 | import org.cloudfoundry.client.CloudFoundryClient; 4 | import org.cloudfoundry.doppler.DopplerClient; 5 | import org.cloudfoundry.operations.DefaultCloudFoundryOperations; 6 | import org.cloudfoundry.reactor.DefaultConnectionContext; 7 | import org.cloudfoundry.reactor.TokenProvider; 8 | import org.cloudfoundry.reactor.client.ReactorCloudFoundryClient; 9 | import org.cloudfoundry.reactor.doppler.ReactorDopplerClient; 10 | import org.cloudfoundry.reactor.tokenprovider.PasswordGrantTokenProvider; 11 | import org.cloudfoundry.reactor.uaa.ReactorUaaClient; 12 | import org.cloudfoundry.uaa.UaaClient; 13 | import org.openpaas.paasta.portal.api.util.CfUtils; 14 | import org.springframework.beans.factory.annotation.Value; 15 | import org.springframework.context.annotation.Bean; 16 | import org.springframework.context.annotation.Configuration; 17 | 18 | /** 19 | * Created by mg on 2016-08-03. 20 | */ 21 | 22 | @Configuration 23 | public class CloudfoundryConfig { 24 | 25 | @Bean 26 | DefaultConnectionContext connectionContext(@Value("${cf.apiHost}") String apiHost, 27 | @Value("${cf.sslSkipValidation}") Boolean sslSkipValidation) { 28 | return CfUtils.connectionContext(apiHost, sslSkipValidation); 29 | } 30 | 31 | 32 | @Bean 33 | PasswordGrantTokenProvider tokenProvider(@Value("${cf.clientId}") String clientId, 34 | @Value("${cf.clientSecret}") String clientSecret, 35 | @Value("${cf.username}") String username, 36 | @Value("${cf.password}") String password) { 37 | return CfUtils.tokenProvider(username, password, clientId, clientSecret); 38 | } 39 | 40 | @Bean 41 | ReactorCloudFoundryClient cloudFoundryClient(DefaultConnectionContext connectionContext, TokenProvider tokenProvider) { 42 | return CfUtils.cloudFoundryClient(connectionContext, tokenProvider); 43 | } 44 | 45 | @Bean 46 | ReactorDopplerClient dopplerClient(DefaultConnectionContext connectionContext, TokenProvider tokenProvider) { 47 | return CfUtils.dopplerClient(connectionContext, tokenProvider); 48 | } 49 | 50 | @Bean 51 | ReactorUaaClient uaaClient(DefaultConnectionContext connectionContext, TokenProvider tokenProvider) { 52 | return CfUtils.uaaClient(connectionContext, tokenProvider); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/config/security/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.config.security; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.security.authentication.AuthenticationManager; 8 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 9 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 10 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 11 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 12 | import org.springframework.security.config.http.SessionCreationPolicy; 13 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 14 | 15 | /** 16 | * The type Security config. 17 | */ 18 | @Configuration 19 | @EnableWebSecurity 20 | public class SecurityConfig extends WebSecurityConfigurerAdapter { 21 | 22 | @Value("${security.user.name}") 23 | String username; 24 | 25 | @Value("${security.user.password}") 26 | String password; 27 | 28 | /** 29 | * Configure global. 30 | * 31 | * @throws Exception the exception 32 | */ 33 | 34 | @Bean 35 | public BCryptPasswordEncoder passwordEncoder() { 36 | return new BCryptPasswordEncoder(); 37 | } 38 | 39 | @Autowired 40 | protected void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { 41 | auth 42 | .inMemoryAuthentication() 43 | .withUser(username).password(password).roles("USER"); 44 | } 45 | 46 | @Bean 47 | @Override 48 | public AuthenticationManager authenticationManagerBean() throws Exception { 49 | return super.authenticationManagerBean(); 50 | } 51 | 52 | @Override 53 | protected void configure(HttpSecurity http) throws Exception { 54 | http 55 | .sessionManagement() 56 | .sessionCreationPolicy(SessionCreationPolicy.STATELESS) 57 | .and() 58 | .authorizeRequests() 59 | .antMatchers("/info").permitAll() 60 | .antMatchers("/health").permitAll() 61 | .antMatchers("/**").hasRole("USER") 62 | .anyRequest().authenticated() 63 | .and() 64 | .httpBasic() 65 | .and() 66 | .csrf().disable(); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/controller/SpaceController.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.controller; 2 | 3 | import org.cloudfoundry.client.CloudFoundryClient; 4 | import org.cloudfoundry.reactor.TokenProvider; 5 | import org.openpaas.paasta.portal.api.model.Space; 6 | import org.openpaas.paasta.portal.api.service.OrganizationService; 7 | import org.openpaas.paasta.portal.api.service.SpaceService; 8 | import org.openpaas.paasta.portal.api.util.CfUtils; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.web.bind.annotation.RequestBody; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.RequestMethod; 15 | import org.springframework.web.bind.annotation.RestController; 16 | 17 | import javax.servlet.http.HttpServletRequest; 18 | 19 | /** 20 | * 공간 컨트롤러 - 공간 목록 , 공간 이름 변경 , 공간 생성 및 삭제 등을 제공한다. 21 | * 22 | * @author 조민구 23 | * @version 1.0 24 | * @since 2016.12.4 최초작성 25 | */ 26 | @RestController 27 | @RequestMapping(value = {"space"}) 28 | public class SpaceController extends BaseController { 29 | private static final Logger LOGGER = LoggerFactory.getLogger(SpaceController.class); 30 | 31 | @Autowired 32 | SpaceService spaceService; 33 | @Autowired 34 | OrganizationService organizationService; 35 | 36 | /** 37 | * 공간 요약 정보 조회 38 | * 39 | * @param space the space 40 | * @param request the request 41 | * @return Space respSpace 42 | * @throws Exception the exception 43 | */ 44 | @RequestMapping(value = {"/getSpaceSummary"}, method = RequestMethod.POST) 45 | public Space getSpaceSummary(@RequestBody Space space, HttpServletRequest request) throws Exception { 46 | 47 | LOGGER.info("Get SpaceSummary Start : org={}, space={}", space.getOrgName(), space.getSpaceName()); 48 | 49 | // Get CloudFoundry class 50 | TokenProvider tokenProvider = getTokenProvider(request.getHeader(AUTHORIZATION_HEADER_KEY)); 51 | CloudFoundryClient cloudFoundryClient= CfUtils.cloudFoundryClient(connectionContext, tokenProvider); 52 | 53 | // Service Operation 54 | String organizationId = organizationService.getOrganizationId(cloudFoundryClient, space.getOrgName()); 55 | String spaceId = spaceService.getSpaceId(cloudFoundryClient, organizationId, space.getSpaceName()); 56 | Space spaceSummary = spaceService.getSpaceSummery(cloudFoundryClient, spaceId); 57 | 58 | LOGGER.info("Get SpaceSummary End "); 59 | 60 | //return respSpace; 61 | return spaceSummary; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/AdminMain.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | /** 4 | * org.openpaas.paasta.portal.api.model 5 | * 6 | * @author 김도준 7 | * @version 1.0 8 | * @since 2016.09.08 9 | */ 10 | public class AdminMain { 11 | 12 | private int organizationId; 13 | private String organizationName; 14 | private int spaceId; 15 | private String spaceName; 16 | private int organizationCount; 17 | private int spaceCount; 18 | private int applicationCount; 19 | private int userCount; 20 | 21 | public int getOrganizationId() { 22 | return organizationId; 23 | } 24 | 25 | public void setOrganizationId(int organizationId) { 26 | this.organizationId = organizationId; 27 | } 28 | 29 | public String getOrganizationName() { 30 | return organizationName; 31 | } 32 | 33 | public void setOrganizationName(String organizationName) { 34 | this.organizationName = organizationName; 35 | } 36 | 37 | public int getSpaceId() { 38 | return spaceId; 39 | } 40 | 41 | public void setSpaceId(int spaceId) { 42 | this.spaceId = spaceId; 43 | } 44 | 45 | public String getSpaceName() { 46 | return spaceName; 47 | } 48 | 49 | public void setSpaceName(String spaceName) { 50 | this.spaceName = spaceName; 51 | } 52 | 53 | public int getOrganizationCount() { 54 | return organizationCount; 55 | } 56 | 57 | public void setOrganizationCount(int organizationCount) { 58 | this.organizationCount = organizationCount; 59 | } 60 | 61 | public int getSpaceCount() { 62 | return spaceCount; 63 | } 64 | 65 | public void setSpaceCount(int spaceCount) { 66 | this.spaceCount = spaceCount; 67 | } 68 | 69 | public int getApplicationCount() { 70 | return applicationCount; 71 | } 72 | 73 | public void setApplicationCount(int applicationCount) { 74 | this.applicationCount = applicationCount; 75 | } 76 | 77 | public int getUserCount() { 78 | return userCount; 79 | } 80 | 81 | public void setUserCount(int userCount) { 82 | this.userCount = userCount; 83 | } 84 | 85 | @Override 86 | public String toString() { 87 | return "AdminMain{" + 88 | "organizationId=" + organizationId + 89 | ", organizationName='" + organizationName + '\'' + 90 | ", spaceId=" + spaceId + 91 | ", spaceName='" + spaceName + '\'' + 92 | ", organizationCount=" + organizationCount + 93 | ", spaceCount=" + spaceCount + 94 | ", applicationCount=" + applicationCount + 95 | ", userCount=" + userCount + 96 | '}'; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/Org.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.UUID; 6 | 7 | /** 8 | * 클래스 설명 9 | * 10 | * @author nawkm 11 | * @version 1.0 12 | * @since 2016.4.4 최초작성 13 | */ 14 | 15 | public class Org extends Entity { 16 | private String orgName; 17 | private String newOrgName; 18 | 19 | private UUID guid; 20 | private String name; 21 | private String status; 22 | private int memoryUsage; 23 | private int memoryLimit; 24 | 25 | 26 | private List spaces = new ArrayList(); 27 | 28 | private boolean billingEnabled = false; 29 | 30 | private Quota quota; 31 | 32 | public Org() { 33 | //empty 34 | } 35 | 36 | public boolean isBillingEnabled() { 37 | return billingEnabled; 38 | } 39 | 40 | public void setBillingEnabled(boolean billingEnabled) { 41 | this.billingEnabled = billingEnabled; 42 | } 43 | 44 | public Quota getQuota() { 45 | return quota; 46 | } 47 | 48 | public void setQuota(Quota quota) { 49 | this.quota = quota; 50 | } 51 | 52 | public String getOrgName() { 53 | return orgName; 54 | } 55 | 56 | public void setOrgName(String orgName) { 57 | this.orgName = orgName; 58 | } 59 | 60 | public String getNewOrgName() { 61 | return newOrgName; 62 | } 63 | 64 | public void setNewOrgName(String newOrgName) { 65 | this.newOrgName = newOrgName; 66 | } 67 | 68 | 69 | public int getMemoryUsage() { 70 | return memoryUsage; 71 | } 72 | 73 | public void setMemoryUsage(int memoryUsage) { 74 | this.memoryUsage = memoryUsage; 75 | } 76 | 77 | public int getMemoryLimit() { 78 | return memoryLimit; 79 | } 80 | 81 | public void setMemoryLimit(int memoryLimit) { 82 | this.memoryLimit = memoryLimit; 83 | } 84 | 85 | public List getSpaces() { 86 | return spaces; 87 | } 88 | 89 | public void setSpaces(List spaces) { 90 | this.spaces = spaces; 91 | } 92 | 93 | public UUID getGuid() { 94 | return guid; 95 | } 96 | 97 | public void setGuid(UUID guid) { 98 | this.guid = guid; 99 | } 100 | 101 | @Override 102 | public String getName() { 103 | return name; 104 | } 105 | 106 | @Override 107 | public void setName(String name) { 108 | this.name = name; 109 | } 110 | 111 | public String getStatus() { 112 | return status; 113 | } 114 | 115 | public void setStatus(String status) { 116 | this.status = status; 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/controller/AppController.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.controller; 2 | 3 | import org.cloudfoundry.client.CloudFoundryClient; 4 | import org.cloudfoundry.doppler.Envelope; 5 | import org.cloudfoundry.reactor.TokenProvider; 6 | import org.cloudfoundry.reactor.doppler.ReactorDopplerClient; 7 | import org.openpaas.paasta.portal.api.model.App; 8 | import org.openpaas.paasta.portal.api.service.AppService; 9 | import org.openpaas.paasta.portal.api.service.OrganizationService; 10 | import org.openpaas.paasta.portal.api.util.CfUtils; 11 | import org.slf4j.Logger; 12 | import org.slf4j.LoggerFactory; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.web.bind.annotation.RequestBody; 15 | import org.springframework.web.bind.annotation.RequestMapping; 16 | import org.springframework.web.bind.annotation.RequestMethod; 17 | import org.springframework.web.bind.annotation.RestController; 18 | 19 | import javax.servlet.http.HttpServletRequest; 20 | import java.util.HashMap; 21 | import java.util.Map; 22 | import java.util.stream.Stream; 23 | 24 | /** 25 | * 앱 컨트롤러 - 애플리케이션 정보 조회, 구동, 정지 등의 API 를 호출 하는 컨트롤러이다. 26 | * 27 | * @author 조민구 28 | * @version 1.0 29 | * @since 2016.12.4 최초작성 30 | */ 31 | @RestController 32 | @RequestMapping(value = {"app"}) 33 | public class AppController extends BaseController { 34 | private static final Logger LOGGER = LoggerFactory.getLogger(AppController.class); 35 | 36 | @Autowired 37 | AppService appService; 38 | @Autowired 39 | OrganizationService organizationService; 40 | 41 | /** 42 | * 앱 최근 로그 43 | * 44 | * @param app the app 45 | * @param request the request 46 | * @return Space respSpace 47 | * @throws Exception the exception 48 | */ 49 | @RequestMapping(value = {"/getRecentLogs"}, method = RequestMethod.POST) 50 | public Map getSpaceSummary(@RequestBody App app, HttpServletRequest request) throws Exception { 51 | 52 | LOGGER.info("getRecentLog Start : appGuid={}", app.getGuid().toString()); 53 | 54 | // Get CloudFoundry class 55 | TokenProvider tokenProvider = getTokenProvider(request.getHeader(AUTHORIZATION_HEADER_KEY)); 56 | CloudFoundryClient cloudFoundryClient = CfUtils.cloudFoundryClient(connectionContext, tokenProvider); 57 | ReactorDopplerClient reactorDopplerClient = CfUtils.dopplerClient(connectionContext, tokenProvider); 58 | 59 | Map mapLog = new HashMap(); 60 | try { 61 | Stream list = appService.getRecentLog(reactorDopplerClient, app.getGuid().toString()).toStream(); 62 | 63 | mapLog.put("log", list.toArray()); 64 | 65 | } catch (Exception e) { 66 | mapLog.put("log", ""); 67 | } 68 | 69 | return mapLog; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/resources/mapper/mysql/portal/QuestionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 23 | 24 | 36 | 37 | 38 | 39 | UPDATE question SET 40 | title = #{question.title}, 41 | content = #{question.status}, 42 | classification = #{question.classification}, 43 | cell_phone = #{question.cellPhone}, 44 | file_name = #{question.fileName}, 45 | file_path = #{question.filePath}, 46 | status = #{question.status}, 47 | lastmodified = now() 48 | WHERE no = #{question.no} 49 | 50 | 51 | 53 | INSERT INTO question ( 54 | title, 55 | user_id, 56 | content, 57 | classification, 58 | cell_phone, 59 | file_name, 60 | file_path, 61 | status 62 | ) 63 | VALUES ( 64 | #{question.title}, 65 | #{question.userId}, 66 | #{question.content}, 67 | #{question.classification}, 68 | #{question.cellPhone}, 69 | #{question.fileName}, 70 | #{question.filePath}, 71 | #{question.status} 72 | ); 73 | 74 | 75 | 76 | DELETE FROM question 77 | WHERE no = #{question.no} 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /src/main/resources/mapper/postgresql/portal/QuestionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 23 | 24 | 36 | 37 | 38 | 39 | UPDATE question SET 40 | title = #{question.title}, 41 | content = #{question.status}, 42 | classification = #{question.classification}, 43 | cell_phone = #{question.cellPhone}, 44 | file_name = #{question.fileName}, 45 | file_path = #{question.filePath}, 46 | status = #{question.status}, 47 | lastmodified = now() 48 | WHERE no = #{question.no} 49 | 50 | 51 | 53 | INSERT INTO question ( 54 | title, 55 | user_id, 56 | content, 57 | classification, 58 | cell_phone, 59 | file_name, 60 | file_path, 61 | status 62 | ) 63 | VALUES ( 64 | #{question.title}, 65 | #{question.userId}, 66 | #{question.content}, 67 | #{question.classification}, 68 | #{question.cellPhone}, 69 | #{question.fileName}, 70 | #{question.filePath}, 71 | #{question.status} 72 | ); 73 | 74 | 75 | 76 | DELETE FROM question 77 | WHERE no = #{question.no} 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/AppAutoScale.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * 클래스 설명 9 | * 10 | * @author injeong 11 | * @version 1.0 12 | * @since 2016.7.01 최초작성 13 | */ 14 | @JsonIgnoreProperties(ignoreUnknown = true) 15 | public class AppAutoScale { 16 | private int no; 17 | private String guid; 18 | 19 | private String name; 20 | 21 | private String useYn; 22 | private int instanceMinCnt; 23 | 24 | private int instanceMaxCnt; 25 | private Map map; 26 | 27 | 28 | private double cpuThresholdMinPer; 29 | 30 | private double cpuThresholdMaxPer; 31 | 32 | private int checkTimeSec; 33 | public AppAutoScale() { 34 | 35 | } 36 | 37 | public int getNo() { 38 | return no; 39 | } 40 | 41 | public void setNo(int no) { 42 | this.no = no; 43 | } 44 | 45 | public String getGuid() { 46 | return guid; 47 | } 48 | 49 | public void setGuid(String guid) { 50 | this.guid = guid; 51 | } 52 | 53 | public String getName() { 54 | return name; 55 | } 56 | 57 | public void setName(String name) { 58 | this.name = name; 59 | } 60 | 61 | public String getUseYn() { 62 | return useYn; 63 | } 64 | 65 | public void setUseYn(String useYn) { 66 | this.useYn = useYn; 67 | } 68 | 69 | public int getInstanceMinCnt() { 70 | return instanceMinCnt; 71 | } 72 | 73 | public void setInstanceMinCnt(int instanceMinCnt) { 74 | this.instanceMinCnt = instanceMinCnt; 75 | } 76 | 77 | public int getInstanceMaxCnt() { 78 | return instanceMaxCnt; 79 | } 80 | 81 | public void setInstanceMaxCnt(int instanceMaxCnt) { 82 | this.instanceMaxCnt = instanceMaxCnt; 83 | } 84 | 85 | public Map getMap() { 86 | return map; 87 | } 88 | 89 | public void setMap(Map map) { 90 | this.map = map; 91 | } 92 | 93 | public double getCheckTimeSec() { 94 | return checkTimeSec; 95 | } 96 | 97 | public void setCheckTimeSec(int checkTimeSec) { 98 | this.checkTimeSec = checkTimeSec; 99 | } 100 | 101 | public double getCpuThresholdMaxPer() { 102 | return cpuThresholdMaxPer; 103 | } 104 | 105 | public void setCpu_threshold_max_per(double cpuThresholdMaxPer) { 106 | this.cpuThresholdMaxPer = cpuThresholdMaxPer; 107 | } 108 | 109 | public double getCpuThresholdMinPer() { 110 | return cpuThresholdMinPer; 111 | } 112 | 113 | public void setCpuThresholdMinPer(double cpuThresholdMinPer) { 114 | this.cpuThresholdMinPer = cpuThresholdMinPer; 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/service/SpaceService.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.service; 2 | 3 | import com.google.gson.Gson; 4 | import org.cloudfoundry.client.CloudFoundryClient; 5 | import org.cloudfoundry.client.v2.spaces.GetSpaceSummaryRequest; 6 | import org.cloudfoundry.client.v2.spaces.GetSpaceSummaryResponse; 7 | import org.cloudfoundry.client.v2.spaces.ListSpacesRequest; 8 | import org.cloudfoundry.client.v2.spaces.SpaceResource; 9 | import org.codehaus.jackson.map.ObjectMapper; 10 | import org.openpaas.paasta.portal.api.model.App; 11 | import org.openpaas.paasta.portal.api.model.Space; 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | import org.springframework.stereotype.Service; 15 | 16 | import java.io.IOException; 17 | import java.util.List; 18 | 19 | /** 20 | * 공간 서비스 - 공간 목록 , 공간 이름 변경 , 공간 생성 및 삭제 등을 제공한다. 21 | * 22 | * @author 조민구 23 | * @version 1.0 24 | * @since 2016.12.4 최초작성 25 | */ 26 | @Service 27 | public class SpaceService extends CommonService{ 28 | private static final Logger LOGGER = LoggerFactory.getLogger(SpaceService.class); 29 | 30 | public Space getSpaceSummery(CloudFoundryClient cloudFoundryClient, String spaceId) throws IOException { 31 | LOGGER.info("Get Space Summary: spaceId={}", spaceId); 32 | 33 | GetSpaceSummaryResponse spaceSummaryResponse = cloudFoundryClient.spaces().getSummary(GetSpaceSummaryRequest.builder().spaceId(spaceId).build()).block(); 34 | 35 | Gson gson = new Gson(); 36 | 37 | String jsonSummary = gson.toJson(spaceSummaryResponse); 38 | Space space = new ObjectMapper().readValue(jsonSummary, Space.class); 39 | 40 | int memTotal = 0; 41 | int memUsageTotal = 0; 42 | 43 | for (App app : space.getApps()) { 44 | 45 | memTotal += app.getMemory() * app.getInstances(); 46 | 47 | if (app.getState().equals("STARTED")) { 48 | space.setAppCountStarted(space.getAppCountStarted() + 1); 49 | 50 | memUsageTotal += app.getMemory() * app.getInstances(); 51 | 52 | } else if (app.getState().equals("STOPPED")) { 53 | space.setAppCountStopped(space.getAppCountStopped() + 1); 54 | } else { 55 | space.setAppCountCrashed(space.getAppCountCrashed() + 1); 56 | } 57 | } 58 | 59 | space.setMemoryLimit(memTotal); 60 | space.setMemoryUsage(memUsageTotal); 61 | 62 | return space; 63 | } 64 | 65 | public String getSpaceId(CloudFoundryClient cloudFoundryClient, String organizationId, String spaceName) { 66 | LOGGER.info("Get Space Id: organizationId={}, spaceName={}", organizationId, spaceName); 67 | 68 | List spaceList = cloudFoundryClient.spaces().list(ListSpacesRequest.builder().organizationId(organizationId).name(spaceName).build()).block().getResources(); 69 | LOGGER.info("Get Space Id: Result size={}", spaceList.size()); 70 | 71 | return spaceList.get(0).getMetadata().getId(); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/Entity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2012 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openpaas.paasta.portal.api.model; 18 | 19 | import java.util.Date; 20 | import java.util.Map; 21 | import java.util.UUID; 22 | 23 | /** 24 | * @author Thomas Risberg 25 | */ 26 | public class Entity { 27 | 28 | private Meta meta; 29 | 30 | private String name; 31 | 32 | public Entity() { 33 | //empty 34 | } 35 | 36 | public Map map; 37 | 38 | public Entity(Meta meta) { 39 | this(meta, null); 40 | } 41 | 42 | public Entity(Meta meta, String name) { 43 | if (meta != null) { 44 | this.meta = meta; 45 | } 46 | else { 47 | this.meta = Meta.defaultMeta(); 48 | } 49 | this.name = name; 50 | } 51 | 52 | public String getName() { 53 | return name; 54 | } 55 | 56 | public void setName(String name) { 57 | this.name = name; 58 | } 59 | 60 | public Meta getMeta() { 61 | return meta; 62 | } 63 | 64 | public void setMeta(Meta meta) { 65 | this.meta = meta; 66 | } 67 | 68 | @Override 69 | public String toString() { 70 | return this.getClass().getSimpleName() + ": (" + 71 | (meta == null || meta.getGuid() == null ? "-" : meta.getGuid()) + ") " + 72 | getName(); 73 | } 74 | 75 | public static class Meta { 76 | 77 | private UUID guid; 78 | private Date created; 79 | private Date updated; 80 | private String url; 81 | 82 | public Meta(){ 83 | } 84 | 85 | public Meta(UUID guid, Date created, Date updated) { 86 | this.guid = guid; 87 | this.created = created; 88 | this.updated = updated; 89 | } 90 | 91 | public Meta(UUID guid, Date created, Date updated, String url) { 92 | this.guid = guid; 93 | this.created = created; 94 | this.updated = updated; 95 | this.url = url; 96 | } 97 | 98 | public UUID getGuid() { 99 | return guid; 100 | } 101 | 102 | public Date getCreated() { 103 | return created; 104 | } 105 | 106 | public Date getUpdated() { 107 | return updated; 108 | } 109 | 110 | public String getUrl() { 111 | return url; 112 | } 113 | 114 | public static Meta defaultMeta() { 115 | return new Meta(null, null, null); 116 | } 117 | } 118 | public Map getMap() { 119 | return map; 120 | } 121 | 122 | public void setMap(Map map) { 123 | this.map = map; 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /src/main/resources/mapper/mysql/portal/UserManagementMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 43 | 44 | 45 | 46 | /* UserManagement.updateOperatingAuthority */ 47 | UPDATE user_detail SET 48 | 49 | status = #{status}, 50 | 51 | 52 | tell_phone = #{tellPhone}, 53 | 54 | 55 | zip_code = #{zipCode}, 56 | 57 | 58 | address = #{address}, 59 | 60 | 61 | address_detail = #{addressDetail}, 62 | 63 | 64 | user_name = #{userName}, 65 | 66 | 67 | admin_yn = #{adminYn} 68 | 69 | WHERE user_id = #{userId} 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/main/resources/mapper/postgresql/portal/UserManagementMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 43 | 44 | 45 | 46 | /* UserManagement.updateOperatingAuthority */ 47 | UPDATE user_detail SET 48 | 49 | status = #{status}, 50 | 51 | 52 | tell_phone = #{tellPhone}, 53 | 54 | 55 | zip_code = #{zipCode}, 56 | 57 | 58 | address = #{address}, 59 | 60 | 61 | address_detail = #{addressDetail}, 62 | 63 | 64 | user_name = #{userName}, 65 | 66 | 67 | admin_yn = #{adminYn} 68 | 69 | WHERE user_id = #{userId} 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/main/resources/mapper/postgresql/cc/AdminMainCcMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 | 17 | 32 | 33 | 34 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/main/resources/mapper/mysql/cc/AdminMainCcMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 | 17 | 32 | 33 | 34 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/config/datasource/MyBatisConfig.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.config.datasource; 2 | 3 | import org.apache.ibatis.session.SqlSessionFactory; 4 | import org.mybatis.spring.SqlSessionFactoryBean; 5 | import org.mybatis.spring.annotation.MapperScan; 6 | import org.openpaas.paasta.portal.api.config.datasource.surport.Portal; 7 | import org.openpaas.paasta.portal.api.config.datasource.surport.Cc; 8 | import org.openpaas.paasta.portal.api.config.datasource.surport.Uaa; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.beans.factory.annotation.Qualifier; 11 | import org.springframework.context.annotation.Bean; 12 | import org.springframework.context.annotation.Configuration; 13 | import org.springframework.core.env.Environment; 14 | import org.springframework.core.io.support.PathMatchingResourcePatternResolver; 15 | 16 | import javax.sql.DataSource; 17 | import java.io.IOException; 18 | 19 | /** 20 | * Created by mg on 2016-05-20. 21 | */ 22 | public class MyBatisConfig { 23 | 24 | @Autowired 25 | private Environment env; 26 | 27 | public static final String BASE_PACKAGE = "org.openpaas.paasta.portal.api"; 28 | public static final String MYSQL_MAPPER_LOCATIONS_PATH = "classpath:mapper/mysql/**/*.xml"; 29 | public static final String POSTGRES_MAPPER_LOCATIONS_PATH = "classpath:mapper/postgresql/**/*.xml"; 30 | 31 | protected void configureSqlSessionFactory(SqlSessionFactoryBean sessionFactoryBean, DataSource dataSource) throws IOException { 32 | PathMatchingResourcePatternResolver pathResolver = new PathMatchingResourcePatternResolver(); 33 | sessionFactoryBean.setDataSource(dataSource); 34 | 35 | String dataSourceStr = dataSource.toString(); 36 | 37 | if(dataSourceStr.contains("mysql")) { 38 | sessionFactoryBean.setMapperLocations(pathResolver.getResources(MYSQL_MAPPER_LOCATIONS_PATH)); 39 | } 40 | if(dataSourceStr.contains("postgresql")) { 41 | sessionFactoryBean.setMapperLocations(pathResolver.getResources(POSTGRES_MAPPER_LOCATIONS_PATH)); 42 | } 43 | } 44 | } 45 | 46 | @Configuration 47 | @MapperScan(basePackages = MyBatisConfig.BASE_PACKAGE, annotationClass = Cc.class, sqlSessionFactoryRef = "ccSqlSessionFactory") 48 | class CcMyBatisConfig extends MyBatisConfig { 49 | 50 | @Bean 51 | public SqlSessionFactory ccSqlSessionFactory(@Qualifier("ccDataSource") DataSource ccDataSource) throws Exception { 52 | SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean(); 53 | configureSqlSessionFactory(sessionFactoryBean, ccDataSource); 54 | return sessionFactoryBean.getObject(); 55 | } 56 | } 57 | 58 | @Configuration 59 | @MapperScan(basePackages = MyBatisConfig.BASE_PACKAGE, annotationClass = Portal.class, sqlSessionFactoryRef = "portalSqlSessionFactory") 60 | class PortalMyBatisConfig extends MyBatisConfig { 61 | 62 | @Bean 63 | public SqlSessionFactory portalSqlSessionFactory(@Qualifier("portalDataSource") DataSource portalDataSource) throws Exception { 64 | SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean(); 65 | configureSqlSessionFactory(sessionFactoryBean, portalDataSource); 66 | return sessionFactoryBean.getObject(); 67 | } 68 | } 69 | 70 | @Configuration 71 | @MapperScan(basePackages = MyBatisConfig.BASE_PACKAGE, annotationClass = Uaa.class, sqlSessionFactoryRef = "uaaSqlSessionFactory") 72 | class UaaMyBatisConfig extends MyBatisConfig { 73 | 74 | @Bean 75 | public SqlSessionFactory uaaSqlSessionFactory(@Qualifier("uaaDataSource") DataSource uaaDataSource) throws Exception { 76 | SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean(); 77 | configureSqlSessionFactory(sessionFactoryBean, uaaDataSource); 78 | return sessionFactoryBean.getObject(); 79 | } 80 | } -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/Service.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 4 | import org.codehaus.jackson.annotate.JsonProperty; 5 | 6 | import java.util.UUID; 7 | 8 | /** 9 | * 서비스 모델 10 | * 11 | * @author nawkm 12 | * @version 1.0 13 | * @since 2016.5.30 최초작성 14 | */ 15 | @JsonIgnoreProperties(ignoreUnknown = true) 16 | public class Service { 17 | private String name; 18 | private String newName; 19 | 20 | private String orgName; 21 | private String spaceName; 22 | 23 | @JsonProperty("id") 24 | private UUID guid; 25 | 26 | private String servicePlanName; 27 | 28 | private String serviceLabel; 29 | 30 | @JsonProperty("boundApplicationCount") 31 | private int boundAppCount; 32 | 33 | @JsonProperty("servicePlan") 34 | private ServicePlan servicePlan; 35 | 36 | @JsonIgnoreProperties(ignoreUnknown = true) 37 | public class ServicePlan { 38 | 39 | private String name; 40 | 41 | @JsonProperty("service") 42 | private ServiceInfo service; 43 | 44 | public String getName() { 45 | return name; 46 | } 47 | 48 | public void setName(String name) { 49 | this.name = name; 50 | setServicePlanName(name); 51 | } 52 | 53 | public ServiceInfo getService() { 54 | return service; 55 | } 56 | 57 | public void setService(ServiceInfo service) { 58 | this.service = service; 59 | } 60 | 61 | @JsonIgnoreProperties(ignoreUnknown = true) 62 | public class ServiceInfo { 63 | private String label; 64 | 65 | public String getLabel() { 66 | return label; 67 | } 68 | 69 | public void setLabel(String label) { 70 | this.label = label; 71 | setServiceLabel(label); 72 | } 73 | } 74 | 75 | } 76 | 77 | 78 | 79 | public String getName() { 80 | return name; 81 | } 82 | 83 | public void setName(String name) { 84 | this.name = name; 85 | } 86 | 87 | public ServicePlan getServicePlan() { 88 | return servicePlan; 89 | } 90 | 91 | public void setServicePlan(ServicePlan servicePlan) { 92 | this.servicePlan = servicePlan; 93 | } 94 | 95 | public String getServicePlanName() { 96 | return servicePlanName; 97 | } 98 | 99 | public void setServicePlanName(String servicePlanName) { 100 | this.servicePlanName = servicePlanName; 101 | } 102 | 103 | public String getServiceLabel() { 104 | return serviceLabel; 105 | } 106 | 107 | public void setServiceLabel(String serviceLabel) { 108 | this.serviceLabel = serviceLabel; 109 | } 110 | 111 | public int getBoundAppCount() { 112 | return boundAppCount; 113 | } 114 | 115 | public void setBoundAppCount(int boundAppCount) { 116 | this.boundAppCount = boundAppCount; 117 | } 118 | 119 | public String getNewName() { 120 | return newName; 121 | } 122 | 123 | public void setNewName(String newName) { 124 | this.newName = newName; 125 | } 126 | 127 | public UUID getGuid() { 128 | return guid; 129 | } 130 | 131 | public void setGuid(UUID guid) { 132 | this.guid = guid; 133 | } 134 | 135 | public String getOrgName() { 136 | return orgName; 137 | } 138 | 139 | public void setOrgName(String orgName) { 140 | this.orgName = orgName; 141 | } 142 | 143 | public String getSpaceName() { 144 | return spaceName; 145 | } 146 | 147 | public void setSpaceName(String spaceName) { 148 | this.spaceName = spaceName; 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/Question.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by Dojun on 2016-06-07. 7 | */ 8 | public class Question { 9 | 10 | private int no; 11 | private String classification; 12 | private String title; 13 | private String userId; 14 | private String content; 15 | private String cellPhone; 16 | private String status; 17 | private String fileName; 18 | private String filePath; 19 | private Date created; 20 | private Date lastModified; 21 | 22 | public Question(){ 23 | //empty 24 | } 25 | 26 | /* 27 | public Question(Map question) { 28 | 29 | String title = ""+question.get("title"); 30 | String userId = ""+question.get("userId"); 31 | String content = ""+question.get("content"); 32 | String cellPhone = ""+question.get("cellPhone"); 33 | String status = ""+question.get("status"); 34 | Date created = (Date)question.get("created"); 35 | Date lastModified = (Date)question.get("lastModified"); 36 | 37 | if (title != null && !"".equals(title)) this.title = title; 38 | if (userId != null && !"".equals(userId)) this.userId = userId; 39 | if (content != null && !"".equals(content)) this.content = content; 40 | if (cellPhone != null && !"".equals(cellPhone)) this.cellPhone = cellPhone; 41 | if (status != null && !"".equals(status)) this.status = status; 42 | if (created != null && !"".equals(created)) this.created = created; 43 | if (lastModified != null && !"".equals(lastModified)) this.lastModified = lastModified; 44 | 45 | } 46 | */ 47 | 48 | 49 | public int getNo() { 50 | return no; 51 | } 52 | 53 | public void setNo(int no) { 54 | this.no = no; 55 | } 56 | 57 | public String getTitle() { 58 | return title; 59 | } 60 | 61 | public void setTitle(String title) { 62 | this.title = title; 63 | } 64 | 65 | public String getUserId() { 66 | return userId; 67 | } 68 | 69 | public void setUserId(String userId) { 70 | this.userId = userId; 71 | } 72 | 73 | public String getContent() { 74 | return content; 75 | } 76 | 77 | public void setContent(String content) { 78 | this.content = content; 79 | } 80 | 81 | public String getCellPhone() { 82 | return cellPhone; 83 | } 84 | 85 | public void setCellPhone(String cellPhone) { 86 | this.cellPhone = cellPhone; 87 | } 88 | 89 | public String getStatus() { 90 | return status; 91 | } 92 | 93 | public void setStatus(String status) { 94 | this.status = status; 95 | } 96 | 97 | public Date getCreated() { 98 | return created; 99 | } 100 | 101 | public void setCreated(Date created) { 102 | this.created = created; 103 | } 104 | 105 | public Date getLastModified() { 106 | return lastModified; 107 | } 108 | 109 | public void setLastModified(Date lastModified) { 110 | this.lastModified = lastModified; 111 | } 112 | 113 | public String getClassification() { 114 | return classification; 115 | } 116 | 117 | public void setClassification(String classification) { 118 | this.classification = classification; 119 | } 120 | 121 | public String getFileName() { 122 | return fileName; 123 | } 124 | 125 | public void setFileName(String fileName) { 126 | this.fileName = fileName; 127 | } 128 | 129 | public String getFilePath() { 130 | return filePath; 131 | } 132 | 133 | public void setFilePath(String filePath) { 134 | this.filePath = filePath; 135 | } 136 | 137 | } 138 | -------------------------------------------------------------------------------- /src/main/resources/mapper/mysql/portal/MyQuestionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 51 | 52 | 53 | 54 | /* MyQuestion.insertMyQuestion */ 55 | INSERT INTO question ( 56 | `title`, 57 | classification, 58 | user_id, 59 | content, 60 | cell_phone, 61 | status, 62 | file_name, 63 | file_path, 64 | file_size, 65 | created, 66 | lastmodified) 67 | VALUES ( 68 | #{title}, 69 | #{classification}, 70 | #{userId}, 71 | #{content}, 72 | #{cellPhone}, 73 | #{status}, 74 | #{fileName}, 75 | #{filePath}, 76 | #{fileSize}, 77 | now(), 78 | now()); 79 | 80 | 81 | 82 | 83 | /* MyQuestion.updateMyQuestion */ 84 | UPDATE question SET 85 | 86 | title = #{title}, 87 | 88 | 89 | classification = #{classification}, 90 | 91 | 92 | 95 | 96 | cell_phone = #{cellPhone}, 97 | 98 | status = #{status}, 99 | 100 | file_name = #{fileName}, 101 | file_path = #{filePath}, 102 | file_size = #{fileSize}, 103 | lastModified = now() 104 | WHERE `no` = #{no} 105 | 106 | 107 | 108 | 109 | /* MyQuestion.deleteMyQuestion */ 110 | DELETE FROM question 111 | WHERE `no` = #{no} 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /src/main/resources/mapper/postgresql/portal/MyQuestionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 51 | 52 | 53 | 54 | /* MyQuestion.insertMyQuestion */ 55 | INSERT INTO question ( 56 | "title", 57 | classification, 58 | user_id, 59 | content, 60 | cell_phone, 61 | status, 62 | file_name, 63 | file_path, 64 | file_size, 65 | created, 66 | lastmodified) 67 | VALUES ( 68 | #{title}, 69 | #{classification}, 70 | #{userId}, 71 | #{content}, 72 | #{cellPhone}, 73 | #{status}, 74 | #{fileName}, 75 | #{filePath}, 76 | #{fileSize}, 77 | now(), 78 | now()); 79 | 80 | 81 | 82 | 83 | /* MyQuestion.updateMyQuestion */ 84 | UPDATE question SET 85 | 86 | title = #{title}, 87 | 88 | 89 | classification = #{classification}, 90 | 91 | 92 | 95 | 96 | cell_phone = #{cellPhone}, 97 | 98 | status = #{status}, 99 | 100 | file_name = #{fileName}, 101 | file_path = #{filePath}, 102 | file_size = #{fileSize}, 103 | lastModified = now() 104 | WHERE "no" = #{no} 105 | 106 | 107 | 108 | 109 | /* MyQuestion.deleteMyQuestion */ 110 | DELETE FROM question 111 | WHERE "no" = #{no} 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /src/main/resources/mapper/mysql/portal/AppAutoScaleModalMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 26 | 27 | /** AppAutoScaleModalMapper.insertAppAutoScale */ 28 | 29 | select COALESCE(max(no),0)+1 as no from auto_scaling_config 30 | 31 | insert into auto_scaling_config( 32 | no 33 | , guid 34 | , name 35 | , use_yn 36 | , instance_min_cnt 37 | , instance_max_cnt 38 | , cpu_threshold_min_per 39 | , cpu_threshold_max_per 40 | , check_time_sec 41 | ) 42 | values ( 43 | #{no} 44 | ,#{guid} 45 | ,#{name} 46 | ,#{useYn} 47 | ,#{instanceMinCnt} 48 | ,#{instanceMaxCnt} 49 | ,#{cpuThresholdMinPer} 50 | ,#{cpuThresholdMaxPer} 51 | ,#{checkTimeSec} 52 | ); 53 | 54 | 55 | 56 | 57 | /** AppAutoScaleModalMapper.updateAppAutoScale */ 58 | update auto_scaling_config 59 | SET 60 | 61 | guid = #{guid} 62 | 63 | 64 | ,name = #{name} 65 | 66 | 67 | ,use_yn = #{useYn} 68 | 69 | 70 | ,instance_min_cnt = #{instanceMinCnt} 71 | 72 | 73 | ,instance_max_cnt = #{instanceMaxCnt} 74 | 75 | 76 | ,cpu_threshold_min_per = #{cpuThresholdMinPer} 77 | 78 | 79 | ,cpu_threshold_max_per = #{cpuThresholdMaxPer} 80 | 81 | 82 | ,check_time_sec = #{checkTimeSec} 83 | 84 | WHERE 1=1 85 | 86 | AND guid = #{guid} 87 | 88 | 89 | 90 | 91 | /** AppAutoScaleModalMapper.deleteAppAutoScale */ 92 | delete from auto_scaling_config 93 | where 1=1 94 | 95 | AND guid = #{guid} 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /src/main/resources/mapper/postgresql/portal/AppAutoScaleModalMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 26 | 27 | /** AppAutoScaleModalMapper.insertAppAutoScale */ 28 | 29 | select COALESCE(max(no),0)+1 as no from auto_scaling_config 30 | 31 | insert into auto_scaling_config( 32 | no 33 | , guid 34 | , name 35 | , use_yn 36 | , instance_min_cnt 37 | , instance_max_cnt 38 | , cpu_threshold_min_per 39 | , cpu_threshold_max_per 40 | , check_time_sec 41 | ) 42 | values ( 43 | #{no} 44 | ,#{guid} 45 | ,#{name} 46 | ,#{useYn} 47 | ,#{instanceMinCnt} 48 | ,#{instanceMaxCnt} 49 | ,#{cpuThresholdMinPer} 50 | ,#{cpuThresholdMaxPer} 51 | ,#{checkTimeSec} 52 | ); 53 | 54 | 55 | 56 | 57 | /** AppAutoScaleModalMapper.updateAppAutoScale */ 58 | update auto_scaling_config 59 | SET 60 | 61 | guid = #{guid} 62 | 63 | 64 | ,name = #{name} 65 | 66 | 67 | ,use_yn = #{useYn} 68 | 69 | 70 | ,instance_min_cnt = #{instanceMinCnt} 71 | 72 | 73 | ,instance_max_cnt = #{instanceMaxCnt} 74 | 75 | 76 | ,cpu_threshold_min_per = #{cpuThresholdMinPer} 77 | 78 | 79 | ,cpu_threshold_max_per = #{cpuThresholdMaxPer} 80 | 81 | 82 | ,check_time_sec = #{checkTimeSec} 83 | 84 | WHERE 1=1 85 | 86 | AND guid = #{guid} 87 | 88 | 89 | 90 | 91 | /** AppAutoScaleModalMapper.deleteAppAutoScale */ 92 | delete from auto_scaling_config 93 | where 1=1 94 | 95 | AND guid = #{guid} 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /src/test/java/org/openpaas/paasta/portal/api/cloudfoundry/operations/Applications.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.cloudfoundry.operations; 2 | 3 | import org.cloudfoundry.doppler.LogMessage; 4 | import org.cloudfoundry.operations.CloudFoundryOperations; 5 | import org.cloudfoundry.operations.applications.ApplicationSummary; 6 | import org.cloudfoundry.operations.applications.LogsRequest; 7 | import org.junit.Test; 8 | import reactor.core.publisher.Flux; 9 | import static org.cloudfoundry.operations.applications.LogsRequest.Builder; 10 | import java.sql.Timestamp; 11 | 12 | /** 13 | * Created by mg on 2016-08-16. 14 | */ 15 | //@Ignore 16 | public class Applications extends Common{ 17 | 18 | 19 | @Test 20 | public void showApps() { 21 | System.out.println(">>> Show Applications"); 22 | 23 | // Flux apps = getApps().cache(); 24 | // System.out.println("Apps Count="+apps.count().block()); 25 | // apps 26 | // .subscribe( a -> System.out.println("FOUND Application : " + a) ); 27 | 28 | Flux apps = getApps(); 29 | apps.toIterable().forEach(applicationSummary -> { 30 | System.out.println("itor: " + applicationSummary); 31 | }); 32 | 33 | apps.collectList().block(); 34 | 35 | System.out.println("<<< Show Applications"); 36 | 37 | } 38 | 39 | @Test 40 | public void tailLogs() { 41 | String appName = "portal-api"; 42 | 43 | streamLogs(cloudFoundryOperations, appName); 44 | 45 | 46 | 47 | // 1 sec = 1000 48 | 49 | 50 | int sec = 20; 51 | try { 52 | Thread.sleep(sec*1000); 53 | } catch (InterruptedException e) { 54 | e.printStackTrace(); 55 | } 56 | 57 | } 58 | 59 | @Test 60 | public void tailLogsV2() { 61 | String appName = "portal-api"; 62 | 63 | streamLogsV2(cloudFoundryOperations, appName); 64 | 65 | 66 | 67 | // 1 sec = 1000 68 | 69 | 70 | int sec = 20; 71 | try { 72 | Thread.sleep(sec*1000); 73 | } catch (InterruptedException e) { 74 | e.printStackTrace(); 75 | } 76 | 77 | } 78 | 79 | private Flux getApps() { 80 | 81 | return cloudFoundryOperations.applications().list(); 82 | } 83 | 84 | private void streamLogs(CloudFoundryOperations cloudFoundryOperations, String app) { 85 | cloudFoundryOperations.applications().logs(LogsRequest.builder() 86 | .name(app) 87 | .build()).subscribe((msg) -> { 88 | System.out.printf(String.valueOf(getLogStr(msg))); 89 | }, 90 | (error) -> { 91 | error.printStackTrace(); 92 | } 93 | ); 94 | } 95 | 96 | private org.cloudfoundry.operations.applications.Applications applications(){ 97 | return cloudFoundryOperations.applications(); 98 | } 99 | 100 | private void streamLogsV2(CloudFoundryOperations cloudFoundryOperations, String app) { 101 | org.cloudfoundry.operations.applications.Applications applications = applications(); 102 | 103 | Builder logsRequest = LogsRequest.builder(); 104 | Builder builder = logsRequest.name(app); 105 | Flux logMessageFlux = applications.logs(builder.build()); 106 | logMessageFlux.subscribe((msg) -> { 107 | System.out.printf(String.valueOf(getLogStr(msg))); 108 | }, 109 | (error) -> { 110 | error.printStackTrace(); 111 | } 112 | ); 113 | } 114 | 115 | private StringBuffer getLogStr(LogMessage msg) { 116 | return new StringBuffer() 117 | .append(new Timestamp(msg.getTimestamp()/1000000).toLocalDateTime()) 118 | .append(" [") 119 | .append(msg.getSourceType()) 120 | .append("/") 121 | .append(msg.getSourceInstance()) 122 | .append("] [") 123 | .append(msg.getMessageType()) 124 | .append("] ") 125 | .append(msg.getMessage()); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/UserDetail.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | import java.util.Date; 4 | import java.util.Map; 5 | 6 | /** 7 | * user model of portaldb 8 | * 9 | * Created by mg on 2016-05-19. 10 | */ 11 | public class UserDetail { 12 | private String userId; 13 | private String userName; 14 | private String status; 15 | private String tellPhone; 16 | private String zipCode; 17 | private String address; 18 | private String addressDetail; 19 | private String adminYn; 20 | private String imgPath; 21 | 22 | private int count; 23 | 24 | 25 | private String password; 26 | private String refreshToken; 27 | 28 | private Date authAccessTime; 29 | private int authAccessCnt; 30 | 31 | public UserDetail() { 32 | //empty 33 | } 34 | 35 | public UserDetail(Map user) { 36 | this.userId = (user.containsKey("userId"))? (String) user.get("userId"):null; 37 | this.userName = (user.containsKey("userName"))? (String) user.get("userName"):null; 38 | this.status = (user.containsKey("status"))? (String) user.get("status"):null; 39 | this.addressDetail = (user.containsKey("addressDetail"))? (String) user.get("addressDetail"):null; 40 | this.address = (user.containsKey("address"))? (String) user.get("address"):null; 41 | this.tellPhone = (user.containsKey("tellPhone"))? (String) user.get("tellPhone"):null; 42 | this.zipCode = (user.containsKey("zipCode"))? (String) user.get("zipCode"):null; 43 | this.adminYn = (user.containsKey("adminYn"))? (String) user.get("adminYn"):null; 44 | this.imgPath = (user.containsKey("imgPath"))? (String) user.get("imgPath"):null; 45 | } 46 | 47 | public String getUserId() { 48 | return userId; 49 | } 50 | 51 | public void setUserId(String userId) { 52 | this.userId = userId; 53 | } 54 | 55 | public String getStatus() { 56 | return status; 57 | } 58 | 59 | public void setStatus(String status) { 60 | this.status = status; 61 | } 62 | 63 | public String getTellPhone() { 64 | return tellPhone; 65 | } 66 | 67 | public void setTellPhone(String tellPhone) { 68 | this.tellPhone = tellPhone; 69 | } 70 | 71 | public String getZipCode() { 72 | return zipCode; 73 | } 74 | 75 | public void setZipCode(String zipCode) { 76 | this.zipCode = zipCode; 77 | } 78 | 79 | public String getAddress() { 80 | return address; 81 | } 82 | 83 | public void setAddress(String address) { 84 | this.address = address; 85 | } 86 | 87 | public String getAddressDetail() { 88 | return addressDetail; 89 | } 90 | 91 | public void setAddressDetail(String addressDetail) { 92 | this.addressDetail = addressDetail; 93 | } 94 | 95 | public String getUserName() { 96 | return userName; 97 | } 98 | 99 | public void setUserName(String userName) { 100 | this.userName = userName; 101 | } 102 | 103 | public int getCount() { 104 | return count; 105 | } 106 | 107 | public void setCount(int count) { 108 | this.count = count; 109 | } 110 | 111 | public String getAdminYn() { 112 | return adminYn; 113 | } 114 | 115 | public void setAdminYn(String adminYn) { 116 | this.adminYn = adminYn; 117 | } 118 | public String getPassword() { 119 | return password; 120 | } 121 | 122 | public void setPassword(String password) { 123 | this.password = password; 124 | } 125 | public String getRefreshToken() { 126 | return refreshToken; 127 | } 128 | 129 | public void setRefreshToken(String refreshToken) { 130 | this.refreshToken = refreshToken; 131 | } 132 | 133 | public String getImgPath() { 134 | return imgPath; 135 | } 136 | 137 | public void setImgPath(String imgPath) { 138 | this.imgPath = imgPath; 139 | } 140 | 141 | public Date getAuthAccessTime() { 142 | return authAccessTime; 143 | } 144 | 145 | public void setAuthAccessTime(Date authAccessTime) { 146 | this.authAccessTime = authAccessTime; 147 | } 148 | 149 | public int getAuthAccessCnt() { 150 | return authAccessCnt; 151 | } 152 | 153 | public void setAuthAccessCnt(int authAccessCnt) { 154 | this.authAccessCnt = authAccessCnt; 155 | } 156 | 157 | } 158 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/Space.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 4 | import org.codehaus.jackson.annotate.JsonProperty; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import java.util.UUID; 9 | 10 | /** 11 | * Space Model 12 | * 13 | * @author nawkm 14 | * @version 1.0 15 | * @since 2016.4.4 최초작성 16 | */ 17 | @JsonIgnoreProperties(ignoreUnknown = true) 18 | public class Space { 19 | private String orgName; 20 | private String spaceName; 21 | private String newSpaceName; 22 | 23 | @JsonProperty("id") 24 | private UUID guid; 25 | private String name; 26 | 27 | @JsonProperty("service_count") 28 | private int serviceCount = 0; 29 | 30 | @JsonProperty("app_count") 31 | private int appCount = 0; 32 | 33 | private int appCountStarted = 0; 34 | private int appCountStopped = 0; 35 | private int appCountCrashed = 0; 36 | 37 | @JsonProperty("mem_dev_total") 38 | private int memDevTotal; 39 | 40 | @JsonProperty("mem_prd_total") 41 | private int memProdTotal; 42 | 43 | private int memoryUsage; 44 | private int memoryLimit; 45 | 46 | @JsonProperty("applications") 47 | private List apps = new ArrayList(); 48 | 49 | private List services = new ArrayList(); 50 | 51 | public Space(){ 52 | //empty 53 | } 54 | 55 | public String getOrgName() { 56 | return orgName; 57 | } 58 | 59 | public void setOrgName(String orgName) { 60 | this.orgName = orgName; 61 | } 62 | 63 | public String getSpaceName() { 64 | return spaceName; 65 | } 66 | 67 | public void setSpaceName(String spaceName) { 68 | this.spaceName = spaceName; 69 | } 70 | 71 | public String getNewSpaceName() { 72 | return newSpaceName; 73 | } 74 | 75 | public void setNewSpaceName(String newSpaceName) { 76 | this.newSpaceName = newSpaceName; 77 | } 78 | 79 | public UUID getGuid() { 80 | return guid; 81 | } 82 | 83 | public void setGuid(UUID guid) { 84 | this.guid = guid; 85 | } 86 | 87 | public String getName() { 88 | return name; 89 | } 90 | 91 | public void setName(String name) { 92 | this.name = name; 93 | } 94 | 95 | public int getServiceCount() { 96 | return serviceCount; 97 | } 98 | 99 | public void setServiceCount(int serviceCount) { 100 | this.serviceCount = serviceCount; 101 | } 102 | 103 | public int getAppCount() { 104 | return appCount; 105 | } 106 | 107 | public void setAppCount(int appCount) { 108 | this.appCount = appCount; 109 | } 110 | 111 | public int getAppCountStarted() { 112 | return appCountStarted; 113 | } 114 | 115 | public void setAppCountStarted(int appCountStarted) { 116 | this.appCountStarted = appCountStarted; 117 | } 118 | 119 | public int getAppCountStopped() { 120 | return appCountStopped; 121 | } 122 | 123 | public void setAppCountStopped(int appCountStopped) { 124 | this.appCountStopped = appCountStopped; 125 | } 126 | 127 | public int getAppCountCrashed() { 128 | return appCountCrashed; 129 | } 130 | 131 | public void setAppCountCrashed(int appCountCrashed) { 132 | this.appCountCrashed = appCountCrashed; 133 | } 134 | 135 | public int getMemDevTotal() { 136 | return memDevTotal; 137 | } 138 | 139 | public void setMemDevTotal(int memDevTotal) { 140 | this.memDevTotal = memDevTotal; 141 | } 142 | 143 | public int getMemProdTotal() { 144 | return memProdTotal; 145 | } 146 | 147 | public void setMemProdTotal(int memProdTotal) { 148 | this.memProdTotal = memProdTotal; 149 | } 150 | 151 | public List getApps() { 152 | return apps; 153 | } 154 | 155 | public void setApps(List apps) { 156 | this.apps = apps; 157 | } 158 | 159 | public int getMemoryUsage() { 160 | return memoryUsage; 161 | } 162 | 163 | public void setMemoryUsage(int memoryUsage) { 164 | this.memoryUsage = memoryUsage; 165 | } 166 | 167 | public int getMemoryLimit() { 168 | return memoryLimit; 169 | } 170 | 171 | public void setMemoryLimit(int memoryLimit) { 172 | this.memoryLimit = memoryLimit; 173 | } 174 | 175 | public List getServices() { 176 | return services; 177 | } 178 | 179 | public void setServices(List services) { 180 | this.services = services; 181 | } 182 | } 183 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/UserManagement.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | /** 4 | * org.openpaas.paasta.portal.api.model 5 | * 6 | * @author 김도준 7 | * @version 1.0 8 | * @since 2016.08.31 9 | */ 10 | public class UserManagement { 11 | 12 | private String userId; 13 | private String userGuid; 14 | private String status; 15 | private String statusValue; 16 | private String tellPhone; 17 | private String zipCode; 18 | private String address; 19 | private String addressDetail; 20 | private String userName; 21 | private String adminYn; 22 | private String refreshToken; 23 | 24 | private int pageNo; 25 | private int pageSize; 26 | private String searchKeyword; 27 | private int totalCount; 28 | 29 | public String getUserId() { 30 | return userId; 31 | } 32 | 33 | public void setUserId(String userId) { 34 | this.userId = userId; 35 | } 36 | 37 | public String getUserGuid() { 38 | return userGuid; 39 | } 40 | 41 | public void setUserGuid(String userGuid) { 42 | this.userGuid = userGuid; 43 | } 44 | 45 | public String getStatus() { 46 | return status; 47 | } 48 | 49 | public void setStatus(String status) { 50 | this.status = status; 51 | } 52 | 53 | public String getStatusValue() { 54 | return statusValue; 55 | } 56 | 57 | public void setStatusValue(String statusValue) { 58 | this.statusValue = statusValue; 59 | } 60 | 61 | public String getTellPhone() { 62 | return tellPhone; 63 | } 64 | 65 | public void setTellPhone(String tellPhone) { 66 | this.tellPhone = tellPhone; 67 | } 68 | 69 | public String getZipCode() { 70 | return zipCode; 71 | } 72 | 73 | public void setZipCode(String zipCode) { 74 | this.zipCode = zipCode; 75 | } 76 | 77 | public String getAddress() { 78 | return address; 79 | } 80 | 81 | public void setAddress(String address) { 82 | this.address = address; 83 | } 84 | 85 | public String getAddressDetail() { 86 | return addressDetail; 87 | } 88 | 89 | public void setAddressDetail(String addressDetail) { 90 | this.addressDetail = addressDetail; 91 | } 92 | 93 | public String getUserName() { 94 | return userName; 95 | } 96 | 97 | public void setUserName(String userName) { 98 | this.userName = userName; 99 | } 100 | 101 | public String getAdminYn() { 102 | return adminYn; 103 | } 104 | 105 | public void setAdminYn(String adminYn) { 106 | this.adminYn = adminYn; 107 | } 108 | 109 | public String getRefreshToken() { 110 | return refreshToken; 111 | } 112 | 113 | public void setRefreshToken(String refreshToken) { 114 | this.refreshToken = refreshToken; 115 | } 116 | 117 | public int getPageNo() { 118 | return pageNo; 119 | } 120 | 121 | public void setPageNo(int pageNo) { 122 | this.pageNo = pageNo; 123 | } 124 | 125 | public int getPageSize() { 126 | return pageSize; 127 | } 128 | 129 | public void setPageSize(int pageSize) { 130 | this.pageSize = pageSize; 131 | } 132 | 133 | public String getSearchKeyword() { 134 | return searchKeyword; 135 | } 136 | 137 | public void setSearchKeyword(String searchKeyword) { 138 | this.searchKeyword = searchKeyword; 139 | } 140 | 141 | public int getTotalCount() { 142 | return totalCount; 143 | } 144 | 145 | public void setTotalCount(int totalCount) { 146 | this.totalCount = totalCount; 147 | } 148 | 149 | @Override 150 | public String toString() { 151 | return "UserManagement{" + 152 | "userId='" + userId + '\'' + 153 | ", userGuid='" + userGuid + '\'' + 154 | ", status='" + status + '\'' + 155 | ", statusValue='" + statusValue + '\'' + 156 | ", tellPhone='" + tellPhone + '\'' + 157 | ", zipCode='" + zipCode + '\'' + 158 | ", address='" + address + '\'' + 159 | ", addressDetail='" + addressDetail + '\'' + 160 | ", userName='" + userName + '\'' + 161 | ", adminYn='" + adminYn + '\'' + 162 | ", refreshToken='" + refreshToken + '\'' + 163 | ", pageNo=" + pageNo + 164 | ", pageSize=" + pageSize + 165 | ", searchKeyword='" + searchKeyword + '\'' + 166 | ", totalCount=" + totalCount + 167 | '}'; 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /src/main/resources/mapper/mysql/portal/MenuMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | /* commonSearchColumns */ 8 | m.no AS "no", 9 | m.no AS "id", 10 | m.parent_no AS parentNo, 11 | m.sort_no AS sortNo, 12 | m.menu_name AS menuName, 13 | m.menu_name AS "text", 14 | m.menu_path AS menuPath, 15 | m.image_path AS imagePath, 16 | m.open_window_yn AS openWindowYn, 17 | m.login_yn AS loginYn, 18 | m.use_yn AS useYn, 19 | m.description AS description, 20 | m.user_id AS userId, 21 | m.created AS created, 22 | m.lastModified AS lastModified 23 | 24 | 25 | 26 | 30 | 31 | 32 | 53 | 54 | 55 | 62 | 63 | 64 | 65 | /* Menu.insertMenu */ 66 | INSERT INTO menu ( 67 | parent_no, 68 | sort_no, 69 | menu_name, 70 | menu_path, 71 | image_path, 72 | open_window_yn, 73 | login_yn, 74 | use_yn, 75 | description, 76 | user_id, 77 | created, 78 | lastmodified) 79 | VALUES ( 80 | #{parentNo}, 81 | #{sortNo}, 82 | #{menuName}, 83 | #{menuPath}, 84 | #{imagePath}, 85 | #{openWindowYn}, 86 | #{loginYn}, 87 | #{useYn}, 88 | #{description}, 89 | #{userId}, 90 | now(), 91 | now()); 92 | 93 | 94 | 95 | 96 | /* Menu.updateMenu */ 97 | UPDATE menu SET 98 | 99 | parent_no = #{parentNo}, 100 | 101 | 102 | parent_no = 0, 103 | 104 | 105 | sort_no = #{sortNo}, 106 | 107 | 108 | menu_name = #{menuName}, 109 | 110 | 111 | menu_path = #{menuPath}, 112 | 113 | image_path = #{imagePath}, 114 | 115 | open_window_yn = #{openWindowYn}, 116 | 117 | 118 | login_yn = #{loginYn}, 119 | 120 | 121 | use_yn = #{useYn}, 122 | 123 | 126 | 127 | user_id = #{userId}, 128 | 129 | lastModified = now() 130 | WHERE `no` = #{no} 131 | 132 | 133 | 134 | 135 | /* Menu.deleteMenu */ 136 | DELETE FROM menu 137 | WHERE `no` = #{no} 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /src/main/resources/mapper/postgresql/portal/MenuMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | /* commonSearchColumns */ 8 | m.no AS "no", 9 | m.no AS "id", 10 | m.parent_no AS parentNo, 11 | m.sort_no AS sortNo, 12 | m.menu_name AS menuName, 13 | m.menu_name AS "text", 14 | m.menu_path AS menuPath, 15 | m.image_path AS imagePath, 16 | m.open_window_yn AS openWindowYn, 17 | m.login_yn AS loginYn, 18 | m.use_yn AS useYn, 19 | m.description AS description, 20 | m.user_id AS userId, 21 | m.created AS created, 22 | m.lastModified AS lastModified 23 | 24 | 25 | 26 | 30 | 31 | 32 | 53 | 54 | 55 | 62 | 63 | 64 | 65 | /* Menu.insertMenu */ 66 | INSERT INTO menu ( 67 | parent_no, 68 | sort_no, 69 | menu_name, 70 | menu_path, 71 | image_path, 72 | open_window_yn, 73 | login_yn, 74 | use_yn, 75 | description, 76 | user_id, 77 | created, 78 | lastmodified) 79 | VALUES ( 80 | #{parentNo}, 81 | #{sortNo}, 82 | #{menuName}, 83 | #{menuPath}, 84 | #{imagePath}, 85 | #{openWindowYn}, 86 | #{loginYn}, 87 | #{useYn}, 88 | #{description}, 89 | #{userId}, 90 | now(), 91 | now()); 92 | 93 | 94 | 95 | 96 | /* Menu.updateMenu */ 97 | UPDATE menu SET 98 | 99 | parent_no = #{parentNo}, 100 | 101 | 102 | parent_no = 0, 103 | 104 | 105 | sort_no = #{sortNo}, 106 | 107 | 108 | menu_name = #{menuName}, 109 | 110 | 111 | menu_path = #{menuPath}, 112 | 113 | image_path = #{imagePath}, 114 | 115 | open_window_yn = #{openWindowYn}, 116 | 117 | 118 | login_yn = #{loginYn}, 119 | 120 | 121 | use_yn = #{useYn}, 122 | 123 | 126 | 127 | user_id = #{userId}, 128 | 129 | lastModified = now() 130 | WHERE "no" = #{no} 131 | 132 | 133 | 134 | 135 | /* Menu.deleteMenu */ 136 | DELETE FROM menu 137 | WHERE "no" = #{no} 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/config/datasource/DataConfig.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.config.datasource; 2 | 3 | import org.apache.tomcat.jdbc.pool.DataSource; 4 | import org.springframework.beans.factory.annotation.Qualifier; 5 | import org.springframework.beans.factory.annotation.Value; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.context.annotation.Primary; 9 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; 10 | import org.springframework.transaction.PlatformTransactionManager; 11 | import org.springframework.transaction.annotation.EnableTransactionManagement; 12 | 13 | /** 14 | * Data Configuration 15 | * 16 | * @author nawkm 17 | * @version 1.0 18 | * @since 2016.4.4 최초작성 19 | */ 20 | 21 | @Configuration 22 | @EnableTransactionManagement 23 | public class DataConfig { 24 | 25 | /** 26 | * ccdb Data source data source. 27 | * 28 | * @return the data source 29 | */ 30 | @Bean(name = "ccDataSource", destroyMethod = "close") 31 | public DataSource ccDataSource(@Value("${datasource.cc.driverClassName}") String driverClassName, 32 | @Value("${datasource.cc.url}") String url, 33 | @Value("${datasource.cc.username}") String username, 34 | @Value("${datasource.cc.password}") String password) { 35 | return createDataSource(driverClassName, url, username, password); 36 | } 37 | @Bean(name = "ccTransactionManager") 38 | public PlatformTransactionManager ccTransactionManager(@Qualifier("ccDataSource") DataSource ccDataSource) { 39 | DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(ccDataSource); 40 | transactionManager.setGlobalRollbackOnParticipationFailure(false); 41 | return transactionManager; 42 | } 43 | 44 | /** 45 | * portaldb Data source data source. 46 | * 47 | * @return the data source 48 | */ 49 | @Bean(name = "portalDataSource", destroyMethod = "close") 50 | public DataSource portalDataSource(@Value("${datasource.portal.driverClassName}") String driverClassName, 51 | @Value("${datasource.portal.url}") String url, 52 | @Value("${datasource.portal.username}") String username, 53 | @Value("${datasource.portal.password}") String password) { 54 | return createDataSource(driverClassName, url, username, password); 55 | } 56 | @Bean(name = "portalTransactionManager") 57 | public PlatformTransactionManager portalTransactionManager(@Qualifier("portalDataSource") DataSource portalDataSource) { 58 | DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(portalDataSource); 59 | transactionManager.setGlobalRollbackOnParticipationFailure(false); 60 | return transactionManager; 61 | } 62 | 63 | /** 64 | * uaadb Data source data source. 65 | * 66 | * @return the data source 67 | */ 68 | @Primary 69 | @Bean(name = "uaaDataSource", destroyMethod = "close") 70 | public DataSource uaaDataSource(@Value("${datasource.uaa.driverClassName}") String driverClassName, 71 | @Value("${datasource.uaa.url}") String url, 72 | @Value("${datasource.uaa.username}") String username, 73 | @Value("${datasource.uaa.password}") String password) { 74 | return createDataSource(driverClassName, url, username, password); 75 | } 76 | @Primary 77 | @Bean(name = "uaaTransactionManager") 78 | public PlatformTransactionManager uaaTransactionManager(@Qualifier("uaaDataSource") DataSource uaaDataSource) { 79 | DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(uaaDataSource); 80 | transactionManager.setGlobalRollbackOnParticipationFailure(false); 81 | return transactionManager; 82 | } 83 | 84 | /** 85 | * datsource 를 생성 86 | * 87 | * @param driverClassName 88 | * @param url 89 | * @param username 90 | * @param password 91 | * @return DataSource 92 | */ 93 | private DataSource createDataSource(String driverClassName, 94 | String url, 95 | String username, 96 | String password) { 97 | DataSource dataSource = new DataSource(); 98 | 99 | dataSource.setDriverClassName(driverClassName); 100 | dataSource.setUrl(url); 101 | dataSource.setUsername(username); 102 | dataSource.setPassword(password); 103 | 104 | return dataSource; 105 | } 106 | } -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/Menu.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | /** 4 | * org.openpaas.paasta.portal.api.model 5 | * 6 | * @author 김도준 7 | * @version 1.0 8 | * @since 2016.09.29 9 | */ 10 | public class Menu { 11 | 12 | private int no; 13 | private int id; 14 | private int parentNo; 15 | private int sortNo; 16 | private String menuName; 17 | private String text; 18 | private String menuPath; 19 | private String imagePath; 20 | private String openWindowYn; 21 | private String loginYn; 22 | private String useYn; 23 | private String description; 24 | private String userId; 25 | private String created; 26 | private String lastModified; 27 | 28 | private int childCount; 29 | private int maxNo; 30 | 31 | public int getNo() { 32 | return no; 33 | } 34 | 35 | public void setNo(int no) { 36 | this.no = no; 37 | } 38 | 39 | public int getId() { 40 | return id; 41 | } 42 | 43 | public void setId(int id) { 44 | this.id = id; 45 | } 46 | 47 | public int getParentNo() { 48 | return parentNo; 49 | } 50 | 51 | public void setParentNo(int parentNo) { 52 | this.parentNo = parentNo; 53 | } 54 | 55 | public int getSortNo() { 56 | return sortNo; 57 | } 58 | 59 | public void setSortNo(int sortNo) { 60 | this.sortNo = sortNo; 61 | } 62 | 63 | public String getMenuName() { 64 | return menuName; 65 | } 66 | 67 | public void setMenuName(String menuName) { 68 | this.menuName = menuName; 69 | } 70 | 71 | public String getText() { 72 | return text; 73 | } 74 | 75 | public void setText(String text) { 76 | this.text = text; 77 | } 78 | 79 | public String getMenuPath() { 80 | return menuPath; 81 | } 82 | 83 | public void setMenuPath(String menuPath) { 84 | this.menuPath = menuPath; 85 | } 86 | 87 | public String getImagePath() { 88 | return imagePath; 89 | } 90 | 91 | public void setImagePath(String imagePath) { 92 | this.imagePath = imagePath; 93 | } 94 | 95 | public String getOpenWindowYn() { 96 | return openWindowYn; 97 | } 98 | 99 | public void setOpenWindowYn(String openWindowYn) { 100 | this.openWindowYn = openWindowYn; 101 | } 102 | 103 | public String getLoginYn() { 104 | return loginYn; 105 | } 106 | 107 | public void setLoginYn(String loginYn) { 108 | this.loginYn = loginYn; 109 | } 110 | 111 | public String getUseYn() { 112 | return useYn; 113 | } 114 | 115 | public void setUseYn(String useYn) { 116 | this.useYn = useYn; 117 | } 118 | 119 | public String getDescription() { 120 | return description; 121 | } 122 | 123 | public void setDescription(String description) { 124 | this.description = description; 125 | } 126 | 127 | public String getUserId() { 128 | return userId; 129 | } 130 | 131 | public void setUserId(String userId) { 132 | this.userId = userId; 133 | } 134 | 135 | public String getCreated() { 136 | return created; 137 | } 138 | 139 | public void setCreated(String created) { 140 | this.created = created; 141 | } 142 | 143 | public String getLastModified() { 144 | return lastModified; 145 | } 146 | 147 | public void setLastModified(String lastModified) { 148 | this.lastModified = lastModified; 149 | } 150 | 151 | public int getChildCount() { 152 | return childCount; 153 | } 154 | 155 | public void setChildCount(int childCount) { 156 | this.childCount = childCount; 157 | } 158 | 159 | public int getMaxNo() { 160 | return maxNo; 161 | } 162 | 163 | public void setMaxNo(int maxNo) { 164 | this.maxNo = maxNo; 165 | } 166 | 167 | @Override 168 | public String toString() { 169 | return "Menu{" + 170 | "no=" + no + 171 | ", id=" + id + 172 | ", parentNo=" + parentNo + 173 | ", sortNo=" + sortNo + 174 | ", menuName='" + menuName + '\'' + 175 | ", text='" + text + '\'' + 176 | ", menuPath='" + menuPath + '\'' + 177 | ", imagePath='" + imagePath + '\'' + 178 | ", openWindowYn='" + openWindowYn + '\'' + 179 | ", loginYn='" + loginYn + '\'' + 180 | ", useYn='" + useYn + '\'' + 181 | ", description='" + description + '\'' + 182 | ", userId='" + userId + '\'' + 183 | ", created='" + created + '\'' + 184 | ", lastModified='" + lastModified + '\'' + 185 | ", childCount=" + childCount + 186 | ", maxNo=" + maxNo + 187 | '}'; 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/Usage.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | /** 4 | * org.openpaas.paasta.portal.api.model 5 | * 6 | * @author 김도준 7 | * @version 1.0 8 | * @since 2016.09.22 9 | */ 10 | public class Usage { 11 | 12 | private String orgName; 13 | private String spaceName; 14 | 15 | private String orgGuid; 16 | private String fromMonth; 17 | private String toMonth; 18 | private int searchPeriodSum; 19 | private String monthlyUsageArr; 20 | private String month; 21 | private int monthlySum; 22 | private String spaces; 23 | private String spaceGuid; 24 | private String spaceSum; 25 | private String appUsageArr; 26 | private String appGuid; 27 | private String appName; 28 | private int appInstance; 29 | private String appMemory; 30 | private int appUsage; 31 | 32 | public String getOrgName() { 33 | return orgName; 34 | } 35 | 36 | public void setOrgName(String orgName) { 37 | this.orgName = orgName; 38 | } 39 | 40 | public String getSpaceName() { 41 | return spaceName; 42 | } 43 | 44 | public void setSpaceName(String spaceName) { 45 | this.spaceName = spaceName; 46 | } 47 | 48 | public String getOrgGuid() { 49 | return orgGuid; 50 | } 51 | 52 | public void setOrgGuid(String orgGuid) { 53 | this.orgGuid = orgGuid; 54 | } 55 | 56 | public String getFromMonth() { 57 | return fromMonth; 58 | } 59 | 60 | public void setFromMonth(String fromMonth) { 61 | this.fromMonth = fromMonth; 62 | } 63 | 64 | public String getToMonth() { 65 | return toMonth; 66 | } 67 | 68 | public void setToMonth(String toMonth) { 69 | this.toMonth = toMonth; 70 | } 71 | 72 | public int getSearchPeriodSum() { 73 | return searchPeriodSum; 74 | } 75 | 76 | public void setSearchPeriodSum(int searchPeriodSum) { 77 | this.searchPeriodSum = searchPeriodSum; 78 | } 79 | 80 | public String getMonthlyUsageArr() { 81 | return monthlyUsageArr; 82 | } 83 | 84 | public void setMonthlyUsageArr(String monthlyUsageArr) { 85 | this.monthlyUsageArr = monthlyUsageArr; 86 | } 87 | 88 | public String getMonth() { 89 | return month; 90 | } 91 | 92 | public void setMonth(String month) { 93 | this.month = month; 94 | } 95 | 96 | public int getMonthlySum() { 97 | return monthlySum; 98 | } 99 | 100 | public void setMonthlySum(int monthlySum) { 101 | this.monthlySum = monthlySum; 102 | } 103 | 104 | public String getSpaces() { 105 | return spaces; 106 | } 107 | 108 | public void setSpaces(String spaces) { 109 | this.spaces = spaces; 110 | } 111 | 112 | public String getSpaceGuid() { 113 | return spaceGuid; 114 | } 115 | 116 | public void setSpaceGuid(String spaceGuid) { 117 | this.spaceGuid = spaceGuid; 118 | } 119 | 120 | public String getSpaceSum() { 121 | return spaceSum; 122 | } 123 | 124 | public void setSpaceSum(String spaceSum) { 125 | this.spaceSum = spaceSum; 126 | } 127 | 128 | public String getAppUsageArr() { 129 | return appUsageArr; 130 | } 131 | 132 | public void setAppUsageArr(String appUsageArr) { 133 | this.appUsageArr = appUsageArr; 134 | } 135 | 136 | public String getAppGuid() { 137 | return appGuid; 138 | } 139 | 140 | public void setAppGuid(String appGuid) { 141 | this.appGuid = appGuid; 142 | } 143 | 144 | public String getAppName() { 145 | return appName; 146 | } 147 | 148 | public void setAppName(String appName) { 149 | this.appName = appName; 150 | } 151 | 152 | public int getAppInstance() { 153 | return appInstance; 154 | } 155 | 156 | public void setAppInstance(int appInstance) { 157 | this.appInstance = appInstance; 158 | } 159 | 160 | public String getAppMemory() { 161 | return appMemory; 162 | } 163 | 164 | public void setAppMemory(String appMemory) { 165 | this.appMemory = appMemory; 166 | } 167 | 168 | public int getAppUsage() { 169 | return appUsage; 170 | } 171 | 172 | public void setAppUsage(int appUsage) { 173 | this.appUsage = appUsage; 174 | } 175 | 176 | @Override 177 | public String toString() { 178 | return "Usage{" + 179 | "orgName='" + orgName + '\'' + 180 | ", spaceName='" + spaceName + '\'' + 181 | ", orgGuid='" + orgGuid + '\'' + 182 | ", fromMonth='" + fromMonth + '\'' + 183 | ", toMonth='" + toMonth + '\'' + 184 | ", searchPeriodSum=" + searchPeriodSum + 185 | ", monthlyUsageArr='" + monthlyUsageArr + '\'' + 186 | ", month='" + month + '\'' + 187 | ", monthlySum=" + monthlySum + 188 | ", spaces='" + spaces + '\'' + 189 | ", spaceGuid='" + spaceGuid + '\'' + 190 | ", spaceSum='" + spaceSum + '\'' + 191 | ", appUsageArr='" + appUsageArr + '\'' + 192 | ", appGuid='" + appGuid + '\'' + 193 | ", appName='" + appName + '\'' + 194 | ", appInstance=" + appInstance + 195 | ", appMemory='" + appMemory + '\'' + 196 | ", appUsage=" + appUsage + 197 | '}'; 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/MyQuestion.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | /** 4 | * org.openpaas.paasta.portal.web.admin.model 5 | * 6 | * @author 김도준 7 | * @version 1.0 8 | * @since 2016.06.17 9 | */ 10 | public class MyQuestion { 11 | 12 | private int no; 13 | private String title; 14 | private String classification; 15 | private String classificationValue; 16 | private String userId; 17 | private String content; 18 | private String cellPhone; 19 | private String status; 20 | private String statusValue; 21 | private String fileName; 22 | private String filePath; 23 | private int fileSize; 24 | private String created; 25 | private String lastModified; 26 | 27 | private int pageNo; 28 | private int pageSize; 29 | private String searchKeyword; 30 | private int totalCount; 31 | 32 | public int getNo() { 33 | return no; 34 | } 35 | 36 | public void setNo(int no) { 37 | this.no = no; 38 | } 39 | 40 | public String getTitle() { 41 | return title; 42 | } 43 | 44 | public void setTitle(String title) { 45 | this.title = title; 46 | } 47 | 48 | public String getClassification() { 49 | return classification; 50 | } 51 | 52 | public void setClassification(String classification) { 53 | this.classification = classification; 54 | } 55 | 56 | public String getClassificationValue() { 57 | return classificationValue; 58 | } 59 | 60 | public void setClassificationValue(String classificationValue) { 61 | this.classificationValue = classificationValue; 62 | } 63 | 64 | public String getUserId() { 65 | return userId; 66 | } 67 | 68 | public void setUserId(String userId) { 69 | this.userId = userId; 70 | } 71 | 72 | public String getContent() { 73 | return content; 74 | } 75 | 76 | public void setContent(String content) { 77 | this.content = content; 78 | } 79 | 80 | public String getCellPhone() { 81 | return cellPhone; 82 | } 83 | 84 | public void setCellPhone(String cellPhone) { 85 | this.cellPhone = cellPhone; 86 | } 87 | 88 | public String getStatus() { 89 | return status; 90 | } 91 | 92 | public void setStatus(String status) { 93 | this.status = status; 94 | } 95 | 96 | public String getStatusValue() { 97 | return statusValue; 98 | } 99 | 100 | public void setStatusValue(String statusValue) { 101 | this.statusValue = statusValue; 102 | } 103 | 104 | public String getFileName() { 105 | return fileName; 106 | } 107 | 108 | public void setFileName(String fileName) { 109 | this.fileName = fileName; 110 | } 111 | 112 | public String getFilePath() { 113 | return filePath; 114 | } 115 | 116 | public void setFilePath(String filePath) { 117 | this.filePath = filePath; 118 | } 119 | 120 | public int getFileSize() { 121 | return fileSize; 122 | } 123 | 124 | public void setFileSize(int fileSize) { 125 | this.fileSize = fileSize; 126 | } 127 | 128 | public String getCreated() { 129 | return created; 130 | } 131 | 132 | public void setCreated(String created) { 133 | this.created = created; 134 | } 135 | 136 | public String getLastModified() { 137 | return lastModified; 138 | } 139 | 140 | public void setLastModified(String lastModified) { 141 | this.lastModified = lastModified; 142 | } 143 | 144 | public int getPageNo() { 145 | return pageNo; 146 | } 147 | 148 | public void setPageNo(int pageNo) { 149 | this.pageNo = pageNo; 150 | } 151 | 152 | public int getPageSize() { 153 | return pageSize; 154 | } 155 | 156 | public void setPageSize(int pageSize) { 157 | this.pageSize = pageSize; 158 | } 159 | 160 | public String getSearchKeyword() { 161 | return searchKeyword; 162 | } 163 | 164 | public void setSearchKeyword(String searchKeyword) { 165 | this.searchKeyword = searchKeyword; 166 | } 167 | 168 | public int getTotalCount() { 169 | return totalCount; 170 | } 171 | 172 | public void setTotalCount(int totalCount) { 173 | this.totalCount = totalCount; 174 | } 175 | 176 | @Override 177 | public String toString() { 178 | return "MyQuestion{" + 179 | "no=" + no + 180 | ", title='" + title + '\'' + 181 | ", classification='" + classification + '\'' + 182 | ", classificationValue='" + classificationValue + '\'' + 183 | ", userId='" + userId + '\'' + 184 | ", content='" + content + '\'' + 185 | ", cellPhone='" + cellPhone + '\'' + 186 | ", status='" + status + '\'' + 187 | ", statusValue='" + statusValue + '\'' + 188 | ", fileName='" + fileName + '\'' + 189 | ", filePath='" + filePath + '\'' + 190 | ", fileSize='" + fileSize + '\'' + 191 | ", created='" + created + '\'' + 192 | ", lastModified='" + lastModified + '\'' + 193 | ", pageNo=" + pageNo + 194 | ", pageSize=" + pageSize + 195 | ", searchKeyword='" + searchKeyword + '\'' + 196 | ", totalCount=" + totalCount + 197 | '}'; 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/portal/api/model/CommonCode.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.portal.api.model; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * org.openpaas.paasta.portal.api.model 7 | * 8 | * @author 김도준 9 | * @version 1.0 10 | * @since 2016.06.15 11 | */ 12 | public class CommonCode { 13 | 14 | private String id; 15 | private String orgId; 16 | private String name; 17 | private String key; 18 | private String orgKey; 19 | private String value; 20 | private String groupId; 21 | private String useYn; 22 | private int order; 23 | private String summary; 24 | private String userId; 25 | private String created; 26 | private String lastModified; 27 | 28 | private String procType; 29 | private int pageNo; 30 | private int pageSize; 31 | 32 | private String searchType; 33 | private String searchKeyword; 34 | 35 | private String reqCud; 36 | private List commonCodeList; 37 | 38 | public String getId() { 39 | return id; 40 | } 41 | 42 | public void setId(String id) { 43 | this.id = id; 44 | } 45 | 46 | public String getOrgId() { 47 | return orgId; 48 | } 49 | 50 | public void setOrgId(String orgId) { 51 | this.orgId = orgId; 52 | } 53 | 54 | public String getName() { 55 | return name; 56 | } 57 | 58 | public void setName(String name) { 59 | this.name = name; 60 | } 61 | 62 | public String getKey() { 63 | return key; 64 | } 65 | 66 | public void setKey(String key) { 67 | this.key = key; 68 | } 69 | 70 | public String getOrgKey() { 71 | return orgKey; 72 | } 73 | 74 | public void setOrgKey(String orgKey) { 75 | this.orgKey = orgKey; 76 | } 77 | 78 | public String getValue() { 79 | return value; 80 | } 81 | 82 | public void setValue(String value) { 83 | this.value = value; 84 | } 85 | 86 | public String getGroupId() { 87 | return groupId; 88 | } 89 | 90 | public void setGroupId(String groupId) { 91 | this.groupId = groupId; 92 | } 93 | 94 | public String getUseYn() { 95 | return useYn; 96 | } 97 | 98 | public void setUseYn(String useYn) { 99 | this.useYn = useYn; 100 | } 101 | 102 | public int getOrder() { 103 | return order; 104 | } 105 | 106 | public void setOrder(int order) { 107 | this.order = order; 108 | } 109 | 110 | public String getSummary() { 111 | return summary; 112 | } 113 | 114 | public void setSummary(String summary) { 115 | this.summary = summary; 116 | } 117 | 118 | public String getUserId() { 119 | return userId; 120 | } 121 | 122 | public void setUserId(String userId) { 123 | this.userId = userId; 124 | } 125 | 126 | public String getCreated() { 127 | return created; 128 | } 129 | 130 | public void setCreated(String created) { 131 | this.created = created; 132 | } 133 | 134 | public String getLastModified() { 135 | return lastModified; 136 | } 137 | 138 | public void setLastModified(String lastModified) { 139 | this.lastModified = lastModified; 140 | } 141 | 142 | public String getProcType() { 143 | return procType; 144 | } 145 | 146 | public void setProcType(String procType) { 147 | this.procType = procType; 148 | } 149 | 150 | public int getPageNo() { 151 | return pageNo; 152 | } 153 | 154 | public void setPageNo(int pageNo) { 155 | this.pageNo = pageNo; 156 | } 157 | 158 | public int getPageSize() { 159 | return pageSize; 160 | } 161 | 162 | public void setPageSize(int pageSize) { 163 | this.pageSize = pageSize; 164 | } 165 | 166 | public String getSearchType() { 167 | return searchType; 168 | } 169 | 170 | public void setSearchType(String searchType) { 171 | this.searchType = searchType; 172 | } 173 | 174 | public String getSearchKeyword() { 175 | return searchKeyword; 176 | } 177 | 178 | public void setSearchKeyword(String searchKeyword) { 179 | this.searchKeyword = searchKeyword; 180 | } 181 | 182 | public String getReqCud() { 183 | return reqCud; 184 | } 185 | 186 | public void setReqCud(String reqCud) { 187 | this.reqCud = reqCud; 188 | } 189 | 190 | public List getCommonCodeList() { 191 | return commonCodeList; 192 | } 193 | 194 | public void setCommonCodeList(List commonCodeList) { 195 | this.commonCodeList = commonCodeList; 196 | } 197 | 198 | @Override 199 | public String toString() { 200 | return "CommonCode{" + 201 | "id='" + id + '\'' + 202 | ", orgId='" + orgId + '\'' + 203 | ", name='" + name + '\'' + 204 | ", key='" + key + '\'' + 205 | ", orgKey='" + orgKey + '\'' + 206 | ", value='" + value + '\'' + 207 | ", groupId='" + groupId + '\'' + 208 | ", useYn='" + useYn + '\'' + 209 | ", order=" + order + 210 | ", summary='" + summary + '\'' + 211 | ", userId='" + userId + '\'' + 212 | ", created='" + created + '\'' + 213 | ", lastModified='" + lastModified + '\'' + 214 | ", procType='" + procType + '\'' + 215 | ", pageNo=" + pageNo + 216 | ", pageSize=" + pageSize + 217 | ", searchType='" + searchType + '\'' + 218 | ", searchKeyword='" + searchKeyword + '\'' + 219 | ", reqCud='" + reqCud + '\'' + 220 | ", commonCodeList=" + commonCodeList + 221 | '}'; 222 | } 223 | } 224 | -------------------------------------------------------------------------------- /src/main/resources/mapper/mysql/portal/UserDetailMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 20 | 21 | 22 | 23 | UPDATE user_detail SET 24 | user_id = #{userDetail.userId}, 25 | user_name = #{userDetail.userName}, 26 | status = #{userDetail.status}, 27 | admin_yn = #{userDetail.adminYn}, 28 | tell_phone = #{userDetail.tellPhone}, 29 | zip_code = #{userDetail.zipCode}, 30 | address = #{userDetail.address}, 31 | address_detail = #{userDetail.addressDetail}, 32 | img_path = #{userDetail.imgPath} 33 | WHERE user_detail.user_id = #{userId} 34 | 35 | 36 | 37 | 38 | UPDATE user_detail SET 39 | user_id = #{newUserId} 40 | WHERE user_id = #{oldUserId} 41 | 42 | 43 | 44 | INSERT INTO user_detail ( 45 | user_id, 46 | user_name, 47 | 48 | admin_yn 49 | 50 | status, 51 | tell_phone, 52 | zip_code, 53 | address, 54 | address_detail 55 | ) 56 | VALUES ( 57 | #{userId}, 58 | #{userName}, 59 | 60 | #{adminYn}, 61 | 62 | #{status}, 63 | #{tellPhone}, 64 | #{zipCode}, 65 | #{address}, 66 | #{addressDetail} 67 | ); 68 | 69 | 70 | 71 | DELETE FROM user_detail 72 | WHERE user_id = #{userId} 73 | 74 | 75 | 79 | 80 | 81 | INSERT INTO user_detail( 82 | user_id 83 | , status 84 | , refresh_token 85 | , auth_access_time) 86 | VALUES ( 87 | #{userId} 88 | , 0 89 | , #{refreshToken} 90 | , #{authAccessTime} 91 | ) 92 | 93 | 137 | 138 | 139 | /** UserDetailMapper.upadteUserParam */ 140 | 141 | select status as no from user_detail where user_id = #{searchUserId} 142 | 143 | UPDATE user_detail 144 | SET 145 | status = #{status} /**필수로 있어야 하는 값*/ 146 | 147 | , user_id = #{userId} 148 | 149 | 150 | , user_name = #{username} 151 | 152 | 153 | , tell_phone = #{tellPhone} 154 | 155 | 156 | , zip_code = #{zipCode} 157 | 158 | 159 | AND address = #{address} 160 | 161 | 162 | , address_detail = #{addressDetail} 163 | 164 | 165 | , admin_yn = #{adminYn} 166 | 167 | 168 | , refresh_token = #{refreshToken} 169 | 170 | 171 | , auth_access_time = #{authAccessTime} 172 | 173 | 174 | , auth_access_cnt = #{authAccessCnt} 175 | 176 | WHERE 177 | 1=1 178 | 179 | AND user_id = #{searchUserId} /**필수로 있어야 하는 값*/ 180 | 181 | 182 | 183 | 184 | 185 | -------------------------------------------------------------------------------- /src/main/resources/mapper/postgresql/portal/UserDetailMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 20 | 21 | 22 | 23 | UPDATE user_detail SET 24 | user_id = #{userDetail.userId}, 25 | user_name = #{userDetail.userName}, 26 | status = #{userDetail.status}, 27 | admin_yn = #{userDetail.adminYn}, 28 | tell_phone = #{userDetail.tellPhone}, 29 | zip_code = #{userDetail.zipCode}, 30 | address = #{userDetail.address}, 31 | address_detail = #{userDetail.addressDetail}, 32 | img_path = #{userDetail.imgPath} 33 | WHERE user_detail.user_id = #{userId} 34 | 35 | 36 | 37 | 38 | UPDATE user_detail SET 39 | user_id = #{newUserId} 40 | WHERE user_id = #{oldUserId} 41 | 42 | 43 | 44 | INSERT INTO user_detail ( 45 | user_id, 46 | user_name, 47 | 48 | admin_yn 49 | 50 | status, 51 | tell_phone, 52 | zip_code, 53 | address, 54 | address_detail 55 | ) 56 | VALUES ( 57 | #{userId}, 58 | #{userName}, 59 | 60 | #{adminYn}, 61 | 62 | #{status}, 63 | #{tellPhone}, 64 | #{zipCode}, 65 | #{address}, 66 | #{addressDetail} 67 | ); 68 | 69 | 70 | 71 | DELETE FROM user_detail 72 | WHERE user_id = #{userId} 73 | 74 | 75 | 79 | 80 | 81 | INSERT INTO user_detail( 82 | user_id 83 | , status 84 | , refresh_token 85 | , auth_access_time) 86 | VALUES ( 87 | #{userId} 88 | , 0 89 | , #{refreshToken} 90 | , #{authAccessTime} 91 | ) 92 | 93 | 137 | 138 | 139 | /** UserDetailMapper.upadteUserParam */ 140 | 141 | select status as no from user_detail where user_id = #{searchUserId} 142 | 143 | UPDATE user_detail 144 | SET 145 | status = #{status} /**필수로 있어야 하는 값*/ 146 | 147 | , user_id = #{userId} 148 | 149 | 150 | , user_name = #{username} 151 | 152 | 153 | , tell_phone = #{tellPhone} 154 | 155 | 156 | , zip_code = #{zipCode} 157 | 158 | 159 | AND address = #{address} 160 | 161 | 162 | , address_detail = #{addressDetail} 163 | 164 | 165 | , admin_yn = #{adminYn} 166 | 167 | 168 | , refresh_token = #{refreshToken} 169 | 170 | 171 | , auth_access_time = #{authAccessTime} 172 | 173 | 174 | , auth_access_cnt = #{authAccessCnt} 175 | 176 | WHERE 177 | 1=1 178 | 179 | AND user_id = #{searchUserId} /**필수로 있어야 하는 값*/ 180 | 181 | 182 | 183 | 184 | 185 | -------------------------------------------------------------------------------- /src/main/resources/mapper/postgresql/portal/SupportQnAMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | /* commonSearchColumns */ 8 | "no" AS "no", 9 | "content" AS "content", 10 | "file_name" as "fileName", 11 | "file_path" as "filePath", 12 | "file_size" as "fileSize", 13 | "created" AT TIME ZONE 'Asia/Seoul' AS "created", 14 | "lastmodified" AT TIME ZONE 'Asia/Seoul' AS "lastModified" 15 | 16 | 17 | 18 | /* procSearch */ 19 | 20 | 21 | 22 | 23 | 24 | AND "classification" LIKE concat('%', #{searchKeyword},'%') 25 | 26 | 27 | AND "title" LIKE concat('%', #{searchKeyword},'%') 28 | 29 | 30 | AND user_id LIKE concat('%', #{searchKeyword},'%') 31 | 32 | 33 | AND ("classification" LIKE concat('%', #{searchKeyword},'%') OR "title" LIKE concat('%', #{searchKeyword},'%') OR user_id LIKE concat('%', #{searchKeyword},'%')) 34 | 35 | 36 | AND 1=1 37 | 38 | 39 | 40 | 41 | 42 | 43 | AND created >= to_date(#{searchStartDate}, 'YYYY-MM-DD HH24:MI:SS.MS') 44 | 45 | 46 | AND to_date(#{searchEndDate}, 'YYYY-MM-DD HH24:MI:SS.MS')+1 >= created 47 | 48 | 49 | 50 | 51 | 52 | AND status = #{searchTypeStatus} 53 | 54 | 55 | AND 1=1 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 80 | 81 | 95 | 96 | 108 | 109 | 110 | 111 | 112 | INSERT INTO ANSWER (content, file_name, file_path, file_size, created, lastmodified, question_no, answerer) 113 | values( 114 | #{content}, 115 | #{fileName}, 116 | #{filePath}, 117 | #{fileSize}, 118 | now(), 119 | now(), 120 | #{questionNo}, 121 | #{answerer} 122 | ); 123 | 124 | 125 | 126 | 127 | UPDATE QUESTION SET 128 | 129 | "status" = #{status}, 130 | 131 | 132 | lastModified = now() 133 | 134 | WHERE 1=1 135 | 136 | AND "no" = #{questionNo} 137 | 138 | 139 | 140 | 141 | 142 | /* Catalog.deleteBuildPackCatalog */ 143 | DELETE FROM ANSWER 144 | WHERE 1=1 145 | 146 | AND question_no = #{questionNo} 147 | 148 | 149 | 150 | 151 | 152 | UPDATE ANSWER SET 153 | 154 | "content" = #{content}, 155 | 156 | 157 | "file_name" = #{fileName}, 158 | "file_path" = #{filePath}, 159 | "file_size" = #{fileSize}, 160 | 161 | answerer = #{answerer}, 162 | 163 | lastModified = now() 164 | 165 | WHERE 1=1 166 | 167 | AND question_no = #{questionNo} 168 | 169 | 170 | 171 | 172 | 173 | --------------------------------------------------------------------------------