Line data Source code
1 : // Copyright (C) 2017 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.server.project; 16 : 17 : import com.google.gerrit.extensions.restapi.RestResource; 18 : import com.google.gerrit.extensions.restapi.RestView; 19 : import com.google.gerrit.server.CurrentUser; 20 : import com.google.inject.TypeLiteral; 21 : import org.eclipse.jgit.lib.Config; 22 : 23 : public class DashboardResource implements RestResource { 24 152 : public static final TypeLiteral<RestView<DashboardResource>> DASHBOARD_KIND = 25 152 : new TypeLiteral<>() {}; 26 : 27 : public static DashboardResource projectDefault(ProjectState projectState, CurrentUser user) { 28 2 : return new DashboardResource(projectState, user, null, null, null, true); 29 : } 30 : 31 : private final ProjectState projectState; 32 : private final CurrentUser user; 33 : private final String refName; 34 : private final String pathName; 35 : private final Config config; 36 : private final boolean projectDefault; 37 : 38 : public DashboardResource( 39 : ProjectState projectState, 40 : CurrentUser user, 41 : String refName, 42 : String pathName, 43 : Config config, 44 2 : boolean projectDefault) { 45 2 : this.projectState = projectState; 46 2 : this.user = user; 47 2 : this.refName = refName; 48 2 : this.pathName = pathName; 49 2 : this.config = config; 50 2 : this.projectDefault = projectDefault; 51 2 : } 52 : 53 : public ProjectState getProjectState() { 54 2 : return projectState; 55 : } 56 : 57 : public CurrentUser getUser() { 58 2 : return user; 59 : } 60 : 61 : public String getRefName() { 62 2 : return refName; 63 : } 64 : 65 : public String getPathName() { 66 2 : return pathName; 67 : } 68 : 69 : public Config getConfig() { 70 2 : return config; 71 : } 72 : 73 : public boolean isProjectDefault() { 74 2 : return projectDefault; 75 : } 76 : }