• 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

20.0
/src/main/java/com/smartsheet/api/internal/SheetCrossSheetReferenceResourcesImpl.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.AuthorizationException;
24
import com.smartsheet.api.InvalidRequestException;
25
import com.smartsheet.api.ResourceNotFoundException;
26
import com.smartsheet.api.ServiceUnavailableException;
27
import com.smartsheet.api.SheetCrossSheetReferenceResources;
28
import com.smartsheet.api.SmartsheetException;
29
import com.smartsheet.api.internal.util.QueryUtil;
30
import com.smartsheet.api.models.CrossSheetReference;
31
import com.smartsheet.api.models.PagedResult;
32
import com.smartsheet.api.models.PaginationParameters;
33

34
import java.util.HashMap;
35
import java.util.Map;
36

37
public class SheetCrossSheetReferenceResourcesImpl extends AbstractResources implements SheetCrossSheetReferenceResources {
38
    private static final String SHEETS_PATH = "sheets/";
39

40
    /**
41
     * Constructor.
42
     * <p>
43
     * Exceptions: - IllegalArgumentException : if any argument is null
44
     *
45
     * @param smartsheet the smartsheet
46
     */
47
    public SheetCrossSheetReferenceResourcesImpl(SmartsheetImpl smartsheet) {
48
        super(smartsheet);
1✔
49
    }
1✔
50

51
    /**
52
     * <p>Get all cross sheet references for this sheet</p>
53
     *
54
     * <p>It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/crosssheetreferences</p>
55
     *
56
     * Exceptions:
57
     *   IllegalArgumentException : if any argument is null
58
     *   InvalidRequestException : if there is any problem with the REST API request
59
     *   AuthorizationException : if there is any problem with the REST API authorization(access token)
60
     *   ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
61
     *   SmartsheetRestException : if there is any other REST API related error occurred during the operation
62
     *   SmartsheetException : if there is any other error occurred during the operation
63
     *
64
     * @param sheetId the sheet ID
65
     * @param pagination the pagination parameters
66
     * @return a list of cross sheet references
67
     * @throws SmartsheetException the smartsheet exception
68
     */
69
    public PagedResult<CrossSheetReference> listCrossSheetReferences(
70
            long sheetId,
71
            PaginationParameters pagination
72
    ) throws SmartsheetException {
73
        String path = SHEETS_PATH + sheetId + "/crosssheetreferences";
×
74
        Map<String, Object> parameters = new HashMap<>();
×
75

76
        if (pagination != null) {
×
77
            parameters = pagination.toHashMap();
×
78
        }
79
        path += QueryUtil.generateUrl(null, parameters);
×
80

81
        return this.listResourcesWithWrapper(path, CrossSheetReference.class);
×
82
    }
83

84
    /**
85
     * <p>Get a cross sheet reference.</p>
86
     *
87
     * <p>It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/crosssheetreferences/{crossSheetReferenceId}</p>
88
     *
89
     * @param sheetId the sheet id
90
     * @param crossSheetReferenceId the cross sheet reference id
91
     * @return the cross sheet reference (note that if there is no such resource, this method will throw ResourceNotFoundException
92
     *     rather than returning null).
93
     * @throws IllegalArgumentException if any argument is null or empty string
94
     * @throws InvalidRequestException if there is any problem with the REST API request
95
     * @throws AuthorizationException if there is any problem with  the REST API authorization (access token)
96
     * @throws ResourceNotFoundException if the resource cannot be found
97
     * @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
98
     * @throws SmartsheetException if there is any other error during the operation
99
     */
100
    public CrossSheetReference getCrossSheetReference(long sheetId, long crossSheetReferenceId) throws SmartsheetException {
101
        return this.getResource(SHEETS_PATH + sheetId + "/crosssheetreferences/" + crossSheetReferenceId, CrossSheetReference.class);
×
102
    }
103

104
    /**
105
     * <p>Create a cross sheet reference in the given sheet.</p>
106
     *
107
     * <p>It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/crosssheetreferences</p>
108
     *
109
     * @param sheetId the sheet id
110
     * @param crossSheetReference the cross sheet reference to create
111
     * @return the created cross sheet reference
112
     * @throws IllegalArgumentException if any argument is null or empty string
113
     * @throws InvalidRequestException if there is any problem with the REST API request
114
     * @throws AuthorizationException if there is any problem with  the REST API authorization (access token)
115
     * @throws ResourceNotFoundException if the resource cannot be found
116
     * @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
117
     * @throws SmartsheetException if there is any other error during the operation
118
     */
119
    public CrossSheetReference createCrossSheetReference(long sheetId, CrossSheetReference crossSheetReference) throws SmartsheetException {
120
        return this.createResource(SHEETS_PATH + sheetId + "/crosssheetreferences", CrossSheetReference.class, crossSheetReference);
×
121
    }
122
}
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