Skip to content

Commit 1b3a980

Browse files
jenmerrittRachael Ellen
andauthored
SS7 upgrade: required amendments to samples (#615)
* Edit with branch versioning - update Controller and README * Configure subnetwork trace: update service URL and add authentication * Display utility assocations - update service URL and authentication * Perform valve isolation trace - update service URL and authentication * Trace a utility network - update service URL and authentication * Display subtype feature layer - update service URL and authentication * Trace a utility network - amend feature tables * bring url onto one line * update markdown Co-authored-by: Rachael Ellen <[email protected]>
1 parent 958b02a commit 1b3a980

File tree

12 files changed

+76
-36
lines changed

12 files changed

+76
-36
lines changed

editing/edit-with-branch-versioning/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Click the "Switch version" button in the top left corner to switch back and fort
4040

4141
## About the data
4242

43-
The feature layer used in this sample is [Damage to commercial buildings](https://sampleserver7.arcgisonline.com/arcgis/rest/services/DamageAssessment/FeatureServer/0) located in Naperville, Illinois.
43+
The feature layer used in this sample is [Damage to commercial buildings](https://sampleserver7.arcgisonline.com/server/rest/services/DamageAssessment/FeatureServer/0) located in Naperville, Illinois.
4444

4545
## Additional information
4646

editing/edit-with-branch-versioning/src/main/java/com/esri/samples/edit_with_branch_versioning/EditWithBranchVersioningController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ public void initialize() {
9999

100100
// create a service geodatabase
101101
serviceGeodatabase = new ServiceGeodatabase("https://sampleserver7.arcgisonline" +
102-
".com/arcgis/rest/services/DamageAssessment/FeatureServer");
102+
".com/server/rest/services/DamageAssessment/FeatureServer");
103103

104104
// set the user credentials required to authenticate with the service geodatabase
105-
UserCredential userCredential = new UserCredential("editor01", "editor01.password");
105+
UserCredential userCredential = new UserCredential("editor01", "S7#i2LWmYH75");
106106
serviceGeodatabase.setCredential(userCredential);
107107

108108
// load the service geodatabase

feature_layers/display-subtype-feature-layer/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The sample loads with the sublayer visible on the map. Toggle its visibility wit
2020
4. Set the visibility status using this sublayer's `IsVisible` property.
2121
5. Change the sublayer's symbology with `.setRenderer(Renderer)`.
2222
6. Update the sublayer's minimum scale value with `.setMinScale()`.
23-
23+
2424
## Relevant API
2525

2626
* LabelDefinition
@@ -30,7 +30,7 @@ The sample loads with the sublayer visible on the map. Toggle its visibility wit
3030

3131
## About the data
3232

33-
The [feature service layer](https://sampleserver7.arcgisonline.com/arcgis/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer/100) in this sample represents an electric network in Naperville, Illinois, which contains a utility network with asset classification for different devices.
33+
The [feature service layer](https://sampleserver7.arcgisonline.com/server/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer/) in this sample represents an electric network in Naperville, Illinois, which contains a utility network with asset classification for different devices.
3434

3535
## Tags
3636

feature_layers/display-subtype-feature-layer/src/main/java/com/esri/samples/display_subtype_feature_layer/DisplaySubtypeFeatureLayerController.java

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,19 @@
3030
import com.esri.arcgisruntime.geometry.SpatialReferences;
3131
import com.esri.arcgisruntime.layers.SubtypeFeatureLayer;
3232
import com.esri.arcgisruntime.layers.SubtypeSublayer;
33+
import com.esri.arcgisruntime.loadable.LoadStatus;
3334
import com.esri.arcgisruntime.mapping.ArcGISMap;
3435
import com.esri.arcgisruntime.mapping.BasemapStyle;
3536
import com.esri.arcgisruntime.mapping.Viewpoint;
3637
import com.esri.arcgisruntime.mapping.view.MapView;
38+
import com.esri.arcgisruntime.security.UserCredential;
3739
import com.esri.arcgisruntime.symbology.Renderer;
3840
import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol;
3941
import com.esri.arcgisruntime.symbology.SimpleRenderer;
4042
import com.esri.arcgisruntime.symbology.Symbol;
4143

4244
public class DisplaySubtypeFeatureLayerController {
43-
45+
4446
@FXML private MapView mapView;
4547
@FXML private Label currentMapScaleLabel;
4648
@FXML private Label minScaleLabel;
@@ -61,21 +63,26 @@ public void initialize() {
6163
// create a map with the streets night basemap style and add it to the map view
6264
ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_STREETS_NIGHT);
6365
mapView.setMap(map);
64-
// display the current map scale
66+
// display the current map scale
6567
mapView.addMapScaleChangedListener(mapScaleChangedEvent ->
6668
currentMapScaleLabel.setText("Current map scale: 1:" + Math.round(mapView.getMapScale())));
67-
69+
6870
// set a viewpoint on the map view, to Naperville, Illinois
6971
Viewpoint initialViewpoint = new Viewpoint(new Envelope(-9812691.11079696, 5128687.20710657,
7072
-9812377.9447607, 5128865.36767282, SpatialReferences.getWebMercator()));
7173
mapView.setViewpoint(initialViewpoint);
7274

7375
// create a subtype feature layer from the service feature table, and add it to the map
74-
ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable("https://sampleserver7.arcgisonline" +
75-
".com/arcgis/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer/100");
76+
ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(
77+
"https://sampleserver7.arcgisonline.com/server/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer/0");
78+
79+
// set user credentials to authenticate with the service
80+
UserCredential userCredential = new UserCredential("viewer01", "I68VGU^nMurF");
81+
serviceFeatureTable.setCredential(userCredential);
82+
7683
SubtypeFeatureLayer subtypeFeatureLayer = new SubtypeFeatureLayer(serviceFeatureTable);
7784
map.getOperationalLayers().add(subtypeFeatureLayer);
78-
85+
7986
// access the json required for sublayer label definitions
8087
final String json = IOUtils.toString(getClass().getResourceAsStream("/display_subtype_feature_layer/label_definition.json"), StandardCharsets.UTF_8);
8188

@@ -84,7 +91,7 @@ public void initialize() {
8491
subtypeFeatureLayer.addDoneLoadingListener(() -> {
8592
// show the UI for interaction with the sublayer once it has loaded
8693
vBox.setVisible(true);
87-
94+
8895
// get the Street Light sublayer and define its labels
8996
sublayer = subtypeFeatureLayer.getSublayerWithSubtypeName("Street Light");
9097
sublayer.setLabelsEnabled(true);
@@ -117,11 +124,11 @@ private void handleMinScaleButtonClicked() {
117124
*/
118125
@FXML
119126
private void handleSublayerVisibility() {
120-
sublayer.setVisible(sublayerVisibilityCheckbox.isSelected());
127+
sublayer.setVisible(sublayerVisibilityCheckbox.isSelected());
121128
}
122-
129+
123130
/**
124-
* Sets the renderer of the sublayer to its original format (a white and black circular icon).
131+
* Sets the renderer of the sublayer to its original format (a white and black circular icon).
125132
*/
126133
@FXML
127134
private void handleOriginalRendererButtonClicked() {
@@ -135,7 +142,7 @@ private void handleOriginalRendererButtonClicked() {
135142
private void handleAlternativeRendererButtonClicked() {
136143
sublayer.setRenderer(alternativeRenderer);
137144
}
138-
145+
139146
/**
140147
* Disposes application resources.
141148
*/

utility_network/configure-subnetwork-trace/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Example barrier conditions for the default dataset:
3131
9. Display the count of elements returned within the `UtilityElementTraceResult`.
3232
10. When the 'Reset' button is clicked, set the trace configurations expression back to its original value.
3333

34-
3534
## Relevant API
3635

3736
* CodedValueDomain
@@ -63,8 +62,8 @@ Example barrier conditions for the default dataset:
6362

6463
## About the data
6564

66-
The [feature service](https://sampleserver7.arcgisonline.com/arcgis/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer) in this sample represents an electric network in Naperville, Illinois, which contains a utility network used to run the subnetwork-based trace.
65+
The [feature service](https://sampleserver7.arcgisonline.com/server/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer) in this sample represents an electric network in Naperville, Illinois, which contains a utility network used to run the subnetwork-based trace.
6766

6867
## Tags
6968

70-
category comparison, condition barriers, network analysis, network attribute comparison, trace configuration, traversability, utility network, validate consistency, subnetwork trace
69+
category comparison, condition barriers, network analysis, network attribute comparison, subnetwork trace, trace configuration, traversability, utility network, validate consistency

utility_network/configure-subnetwork-trace/src/main/java/com/esri/samples/configure_subnetwork_trace/ConfigureSubnetworkTraceController.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.esri.arcgisruntime.data.CodedValue;
3333
import com.esri.arcgisruntime.data.CodedValueDomain;
3434
import com.esri.arcgisruntime.loadable.LoadStatus;
35+
import com.esri.arcgisruntime.security.UserCredential;
3536
import com.esri.arcgisruntime.utilitynetworks.UtilityAssetGroup;
3637
import com.esri.arcgisruntime.utilitynetworks.UtilityAssetType;
3738
import com.esri.arcgisruntime.utilitynetworks.UtilityAttributeComparisonOperator;
@@ -87,8 +88,14 @@ public void initialize() {
8788

8889
// load the utility network
8990
utilityNetwork = new UtilityNetwork(
90-
"https://sampleserver7.arcgisonline.com/arcgis/rest/services/UtilityNetwork/NapervilleElectric" +
91+
"https://sampleserver7.arcgisonline.com/server/rest/services/UtilityNetwork/NapervilleElectric" +
9192
"/FeatureServer");
93+
94+
// set user credentials to authenticate with the service
95+
// NOTE: a licensed user is required to perform utility network operations
96+
UserCredential userCredential = new UserCredential("viewer01", "I68VGU^nMurF");
97+
utilityNetwork.setCredential(userCredential);
98+
9299
utilityNetwork.loadAsync();
93100
utilityNetwork.addDoneLoadingListener(() -> {
94101
if (utilityNetwork.getLoadStatus() == LoadStatus.LOADED) {

utility_network/display-utility-associations/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Pan and zoom around the map. Observe graphics that show utility associations bet
3434

3535
## About the data
3636

37-
The [Naperville electrical](https://sampleserver7.arcgisonline.com/arcgis/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer) network feature service, hosted on ArcGIS Online, contains a utility network used to display the utility associations in this sample.
37+
The [Naperville electrical](https://sampleserver7.arcgisonline.com/server/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer) network feature service, hosted on ArcGIS Online, contains a utility network used to display the utility associations in this sample.
3838

3939
## Tags
4040

utility_network/display-utility-associations/src/main/java/com/esri/samples/display_utility_associations/DisplayUtilityAssociationsSample.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
import com.esri.arcgisruntime.mapping.view.Graphic;
4444
import com.esri.arcgisruntime.mapping.view.GraphicsOverlay;
4545
import com.esri.arcgisruntime.mapping.view.MapView;
46+
import com.esri.arcgisruntime.security.AuthenticationManager;
47+
import com.esri.arcgisruntime.security.SelfSignedCertificateListener;
48+
import com.esri.arcgisruntime.security.SelfSignedResponse;
49+
import com.esri.arcgisruntime.security.UserCredential;
4650
import com.esri.arcgisruntime.symbology.SimpleLineSymbol;
4751
import com.esri.arcgisruntime.symbology.UniqueValueRenderer;
4852
import com.esri.arcgisruntime.utilitynetworks.UtilityAssociation;
@@ -87,10 +91,15 @@ public void start(Stage stage) {
8791
// create a map view, set the map, and add the graphics overlay
8892
mapView = new MapView();
8993
mapView.setMap(map);
90-
94+
9195
// create the utility network
92-
utilityNetwork = new UtilityNetwork("https://sampleserver7.arcgisonline.com/arcgis/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer");
93-
96+
utilityNetwork = new UtilityNetwork("https://sampleserver7.arcgisonline.com/server/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer");
97+
98+
// set user credentials to authenticate with the service
99+
// NOTE: a licensed user is required to perform utility network operations
100+
UserCredential userCredential = new UserCredential("viewer01", "I68VGU^nMurF");
101+
utilityNetwork.setCredential(userCredential);
102+
94103
// load the utility network and get all of the edges and junctions in the network
95104
utilityNetwork.loadAsync();
96105
utilityNetwork.addDoneLoadingListener(() -> {

utility_network/perform-valve-isolation-trace/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ Create and set the configuration's filter barriers by selecting a category. Chec
2323
7. Add a `GraphicsOverlay` with the graphic that represents the starting location.
2424
8. Populate the combo box for choosing the filter barrier category from `UtilityNetworkDefinition.getCategories()`.
2525
9. When "Trace" is clicked,
26-
- Create a new `UtilityCategoryComparison` with the selected category and `UtilityCategoryComparisonOperator.EXISTS`.
27-
- Assign this condition to `utilityTraceFilter.setBarriers()` from the default configuration from step 7. Update this configuration's `utilityTraceConfiguration.isIncludeIsolatedFeatures()` property.
28-
- Create a `UtilityTraceParameters` with `UtilityTraceType.ISOLATION` and default starting location from step 4.
29-
- Set its utility trace configuration with this configuration and then, run a `utilityNetwork.traceAsync()`.
26+
* Create a new `UtilityCategoryComparison` with the selected category and `UtilityCategoryComparisonOperator.EXISTS`.
27+
* Assign this condition to `utilityTraceFilter.setBarriers()` from the default configuration from step 7. Update this configuration's `utilityTraceConfiguration.isIncludeIsolatedFeatures()` property.
28+
* Create a `UtilityTraceParameters` with `UtilityTraceType.ISOLATION` and default starting location from step 4.
29+
* Set its utility trace configuration with this configuration and then, run a `utilityNetwork.traceAsync()`.
3030
10. Get the list of `UtilityElement`s from the first trace result.
3131
11. For every feature layer in the map, select all the features for which the layer's `FeatureTable.getTableName()` matches the `NetworkSource.getName()` of one of the utility elements.
3232

@@ -40,16 +40,16 @@ Create and set the configuration's filter barriers by selecting a category. Chec
4040
* UtilityElementTraceResult
4141
* UtilityNetwork
4242
* UtilityNetworkDefinition
43-
* UtilityTraceFilter
4443
* UtilityTier
44+
* UtilityTraceFilter
4545
* UtilityTraceParameters
4646
* UtilityTraceResult
4747
* UtilityTraceType
4848

4949
## About the data
5050

51-
The [Naperville gas](https://sampleserver7.arcgisonline.com/arcgis/rest/services/UtilityNetwork/NapervilleGas/FeatureServer) network feature service, hosted on ArcGIS Online, contains a utility network used to run the isolation trace shown in this sample.
52-
51+
The [Naperville gas](https://sampleserver7.arcgisonline.com/server/rest/services/UtilityNetwork/NapervilleGas/FeatureServer) network feature service, hosted on ArcGIS Online, contains a utility network used to run the isolation trace shown in this sample.
52+
5353
## Tags
5454

5555
category comparison, condition barriers, isolated features, network analysis, subnetwork trace, trace configuration, trace filter, utility network

utility_network/perform-valve-isolation-trace/src/main/java/com/esri/samples/perform_valve_isolation_trace/PerformValveIsolationTraceController.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import com.esri.arcgisruntime.mapping.view.Graphic;
4747
import com.esri.arcgisruntime.mapping.view.GraphicsOverlay;
4848
import com.esri.arcgisruntime.mapping.view.MapView;
49+
import com.esri.arcgisruntime.security.UserCredential;
4950
import com.esri.arcgisruntime.symbology.ColorUtil;
5051
import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol;
5152
import com.esri.arcgisruntime.symbology.SimpleRenderer;
@@ -93,7 +94,7 @@ public void initialize() {
9394

9495
// load the utility network data from the feature service and create feature layers
9596
String featureServiceURL =
96-
"https://sampleserver7.arcgisonline.com/arcgis/rest/services/UtilityNetwork/NapervilleGas/FeatureServer";
97+
"https://sampleserver7.arcgisonline.com/server/rest/services/UtilityNetwork/NapervilleGas/FeatureServer";
9798

9899
ServiceFeatureTable distributionLineFeatureTable = new ServiceFeatureTable(featureServiceURL + "/3");
99100
FeatureLayer distributionLineLayer = new FeatureLayer(distributionLineFeatureTable);
@@ -115,6 +116,12 @@ public void initialize() {
115116

116117
// create and load the utility network
117118
utilityNetwork = new UtilityNetwork(featureServiceURL);
119+
120+
// set user credentials to authenticate with the service
121+
// NOTE: a licensed user is required to perform utility network operations
122+
UserCredential userCredential = new UserCredential("viewer01", "I68VGU^nMurF");
123+
utilityNetwork.setCredential(userCredential);
124+
118125
utilityNetwork.loadAsync();
119126
utilityNetwork.addDoneLoadingListener(() -> {
120127
if (utilityNetwork.getLoadStatus() == LoadStatus.LOADED) {

0 commit comments

Comments
 (0)