From 15b10ba605e48af66fcd0058e8fbbd0006afb827 Mon Sep 17 00:00:00 2001
From: Maciej Pichura <41297682+mpichura@users.noreply.github.com>
Date: Tue, 30 Aug 2022 13:57:31 +0200
Subject: [PATCH] ACS-3431 rule set link TAS changes (#239)
* ACS-3341: Adding initial changes to handle rule set linking.
* ACS-3341: Adding equals/hashcode override to RestRuleSetLinkModel.
* ACS-3341: Adding equals/hashcode override to RestRuleSetModel.
---
.../rest/model/RestRuleSetLinkModel.java | 81 +++++++++++++++++++
.../alfresco/rest/model/RestRuleSetModel.java | 18 +++++
.../java/org/alfresco/rest/requests/Node.java | 7 ++
3 files changed, 106 insertions(+)
create mode 100644 packaging/tests/tas-restapi/src/main/java/org/alfresco/rest/model/RestRuleSetLinkModel.java
diff --git a/packaging/tests/tas-restapi/src/main/java/org/alfresco/rest/model/RestRuleSetLinkModel.java b/packaging/tests/tas-restapi/src/main/java/org/alfresco/rest/model/RestRuleSetLinkModel.java
new file mode 100644
index 0000000000..35cb753f55
--- /dev/null
+++ b/packaging/tests/tas-restapi/src/main/java/org/alfresco/rest/model/RestRuleSetLinkModel.java
@@ -0,0 +1,81 @@
+/*-
+ * #%L
+ * alfresco-tas-restapi
+ * %%
+ * Copyright (C) 2005 - 2022 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
+
+package org.alfresco.rest.model;
+
+import java.util.Objects;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.alfresco.rest.core.IRestModel;
+import org.alfresco.utility.model.TestModel;
+
+/**
+ * Generated by 'mpichura' on '2022-08-29 12:27' from 'Alfresco Content Services REST API' swagger file
+ * Generated from 'Alfresco Content Services REST API' swagger file
+ * Base Path {@linkplain /alfresco/api/-default-/public/alfresco/versions/1}
+ */
+public class RestRuleSetLinkModel extends TestModel implements IRestModel
+{
+ @JsonProperty(value = "entry")
+ RestRuleSetLinkModel model;
+
+ @Override
+ public RestRuleSetLinkModel onModel()
+ {
+ return model;
+ }
+
+ /**
+ Identifier for the folder node containing the rule set or the rule set node itself.
+ */
+
+ private String id;
+
+ public String getId()
+ {
+ return this.id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ RestRuleSetLinkModel that = (RestRuleSetLinkModel) o;
+ return id.equals(that.id);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return Objects.hash(id);
+ }
+}
diff --git a/packaging/tests/tas-restapi/src/main/java/org/alfresco/rest/model/RestRuleSetModel.java b/packaging/tests/tas-restapi/src/main/java/org/alfresco/rest/model/RestRuleSetModel.java
index 0fa9cca05b..2f76391eb1 100644
--- a/packaging/tests/tas-restapi/src/main/java/org/alfresco/rest/model/RestRuleSetModel.java
+++ b/packaging/tests/tas-restapi/src/main/java/org/alfresco/rest/model/RestRuleSetModel.java
@@ -25,6 +25,8 @@
*/
package org.alfresco.rest.model;
+import java.util.Objects;
+
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.IRestModel;
@@ -85,4 +87,20 @@ public class RestRuleSetModel extends TestModel implements IRestModel
{
return usingRuleSetting(IS_INHERITANCE_ENABLED);
}
+
+ public RestRuleSetLinkModel createRuleLink(RestRuleSetLinkModel body)
+ {
+ RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, body.toJson(), "nodes/{nodeId}/rule-set-links", repoModel.getNodeRef());
+ return restWrapper.processModel(RestRuleSetLinkModel.class, request);
+ }
}