Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Commit

Permalink
feat: add "__skipThisObject" attribute to skip objects while performi…
Browse files Browse the repository at this point in the history
…ng `update` command
  • Loading branch information
flyisland committed Mar 15, 2022
1 parent b71798b commit 6ed9b53
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
### Added
- add add "__skipThisObject" attribute to skip objects while performing `update` command
### Fixed

## [1.1.5] - 2022-02-07
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ the "default" VPN or the VPN of the Solace Cloud Service instance, since you
can only update them.
<confPath> Configuration file
--no-delete Do NOT perform DELETE actions, only new objects and update
existed objects
```

## Opaque Password
Expand Down
12 changes: 5 additions & 7 deletions src/main/java/com/solace/tools/solconfig/model/ConfigObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,11 @@ public void generateUpdateCommands(ConfigObject newObj,
newObj.attributes.put(SempSpec.ENABLED_ATTRIBUTE_NAME, false);
}

if ((boolean) newObj.attributes.getOrDefault(SempSpec.SKIP_THIS_OBJECT, false)) {
System.out.println("HAHA");
}

if (!attributes.entrySet().equals(newObj.attributes.entrySet())) {
var payload = newObj.toJsonStringAttributeOnly();
updateCommandList.append(HTTPMethod.PUT, objectPath, payload);
if (! (boolean) newObj.attributes.getOrDefault(SempSpec.SKIP_THIS_OBJECT, false)) {
if (!attributes.entrySet().equals(newObj.attributes.entrySet())) {
var payload = newObj.toJsonStringAttributeOnly();
updateCommandList.append(HTTPMethod.PUT, objectPath, payload);
}
}

for (int i = 0; i < oldChildren.size(); i++) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/solace/tools/solconfig/model/SempSpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.stream.Collectors;

public class SempSpec {
public static final String SKIP_THIS_OBJECT = "skipThisObject";
public static final String SKIP_THIS_OBJECT = "__skipThisObject";
public static final String BROKER_SPEC_PATH = "";
public static final String SEMP_VERSION = "sempVersion";
public static final String OPAQUE_PASSWORD = "opaquePassword";
Expand Down Expand Up @@ -111,6 +111,7 @@ private static SempSpec of(String parentObjectPath, String collectionName) {
spec.childrenNames = jsonSpec.getChildrenNames(objectPath);
spec.sempClassName = jsonSpec.getSempClassName(collectionPath);
spec.attributeCombinations = jsonSpec.findAttributesCombinations(collectionPath);
spec.attributes.get(AttributeType.ALL.toString()).add(SempSpec.SKIP_THIS_OBJECT);

return spec;
}
Expand Down

0 comments on commit 6ed9b53

Please sign in to comment.