• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

smartsheet / smartsheet-java-sdk / #41

24 Aug 2023 04:59PM UTC coverage: 50.458% (+0.01%) from 50.444%
#41

push

github-actions

web-flow
Fix Checkstyle Violations in "Impl" Classes (#53)

241 of 241 new or added lines in 32 files covered. (100.0%)

3417 of 6772 relevant lines covered (50.46%)

0.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

18.18
/src/main/java/com/smartsheet/api/internal/SheetFilterResourcesImpl.java
1
package com.smartsheet.api.internal;
2

3
/*
4
 * #[license]
5
 * Smartsheet SDK for Java
6
 * %%
7
 * Copyright (C) 2023 Smartsheet
8
 * %%
9
 * Licensed under the Apache License, Version 2.0 (the "License");
10
 * you may not use this file except in compliance with the License.
11
 * You may obtain a copy of the License at
12
 *
13
 *      http://www.apache.org/licenses/LICENSE-2.0
14
 *
15
 * Unless required by applicable law or agreed to in writing, software
16
 * distributed under the License is distributed on an "AS IS" BASIS,
17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
 * See the License for the specific language governing permissions and
19
 * limitations under the License.
20
 * %[license]
21
 */
22

23
import com.smartsheet.api.SheetFilterResources;
24
import com.smartsheet.api.SmartsheetException;
25
import com.smartsheet.api.internal.util.QueryUtil;
26
import com.smartsheet.api.models.PagedResult;
27
import com.smartsheet.api.models.PaginationParameters;
28
import com.smartsheet.api.models.SheetFilter;
29

30
import java.util.HashMap;
31
import java.util.Map;
32

33
public class SheetFilterResourcesImpl extends AbstractResources implements SheetFilterResources {
34
    private static final String SHEETS_PATH = "sheets/";
35

36
    /**
37
     * Constructor.
38
     * <p>
39
     * Exceptions:
40
     *   IllegalArgumentException : if any argument is null or empty string
41
     *
42
     * @param smartsheet the smartsheet
43
     */
44
    public SheetFilterResourcesImpl(SmartsheetImpl smartsheet) {
45
        super(smartsheet);
1✔
46
    }
1✔
47

48
    /**
49
     * Get a filter.
50
     * <p>
51
     * It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/filters/{filterId}
52
     * <p>
53
     * Parameters: - filterId : the ID
54
     * <p>
55
     * Returns: the resource (note that if there is no such resource, this method will throw ResourceNotFoundException
56
     * rather than returning null).
57
     * <p>
58
     * Exceptions:
59
     *   InvalidRequestException : if there is any problem with the REST API request
60
     *   AuthorizationException : if there is any problem with the REST API authorization(access token)
61
     *   ResourceNotFoundException : if the resource can not be found
62
     *   ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
63
     *   SmartsheetRestException : if there is any other REST API related error occurred during the operation
64
     *   SmartsheetException : if there is any other error occurred during the operation
65
     *
66
     * @param sheetId the sheetId
67
     * @param filterId the filter ID
68
     * @return the filter
69
     * @throws SmartsheetException the smartsheet exception
70
     */
71
    public SheetFilter getFilter(long sheetId, long filterId) throws SmartsheetException {
72
        return this.getResource(SHEETS_PATH + sheetId + "/filters/" + filterId, SheetFilter.class);
×
73
    }
74

75
    /**
76
     * Delete filter.
77
     * <p>
78
     * It mirrors to the following Smartsheet REST API method: DELETE /sheets/{sheetId}/filters/{filterId}
79
     * <p>
80
     * Exceptions:
81
     *   IllegalArgumentException : if any argument is null
82
     *   InvalidRequestException : if there is any problem with the REST API request
83
     *   AuthorizationException : if there is any problem with the REST API authorization(access token)
84
     *   ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
85
     *   SmartsheetRestException : if there is any other REST API related error occurred during the operation
86
     *   SmartsheetException : if there is any other error occurred during the operation
87
     *
88
     * @param sheetId the sheet ID
89
     * @param filterId the filter ID
90
     * @throws SmartsheetException the smartsheet exception
91
     */
92
    public void deleteFilter(long sheetId, long filterId) throws SmartsheetException {
93
        this.deleteResource(SHEETS_PATH + sheetId + "/filters/" + filterId, SheetFilter.class);
×
94
    }
×
95

96
    /**
97
     * Get all filters.
98
     * <p>
99
     * It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/filters
100
     * <p>
101
     * Exceptions:
102
     *   IllegalArgumentException : if any argument is null
103
     *   InvalidRequestException : if there is any problem with the REST API request
104
     *   AuthorizationException : if there is any problem with the REST API authorization(access token)
105
     *   ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
106
     *   SmartsheetRestException : if there is any other REST API related error occurred during the operation
107
     *   SmartsheetException : if there is any other error occurred during the operation
108
     *
109
     * @param sheetId the sheet ID
110
     * @param pagination the pagination pagination
111
     * @return all the filters
112
     * @throws SmartsheetException the smartsheet exception
113
     */
114
    public PagedResult<SheetFilter> listFilters(long sheetId, PaginationParameters pagination) throws SmartsheetException {
115
        String path = SHEETS_PATH + sheetId + "/filters";
×
116
        Map<String, Object> parameters = new HashMap<>();
×
117

118
        if (pagination != null) {
×
119
            parameters = pagination.toHashMap();
×
120
        }
121
        path += QueryUtil.generateUrl(null, parameters);
×
122

123
        return this.listResourcesWithWrapper(path, SheetFilter.class);
×
124
    }
125
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc