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.
This commit is contained in:
Maciej Pichura
2022-08-30 13:57:31 +02:00
committed by GitHub
parent 8983a11d3d
commit 15b10ba605
3 changed files with 106 additions and 0 deletions

View File

@@ -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 <http://www.gnu.org/licenses/>.
* #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<RestRuleSetLinkModel>
{
@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);
}
}

View File

@@ -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<RestRuleSe
{
this.inclusionType = inclusionType;
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RestRuleSetModel that = (RestRuleSetModel) o;
return Objects.equals(id, that.id) && Objects.equals(owningFolder, that.owningFolder) &&
Objects.equals(inclusionType, that.inclusionType);
}
@Override
public int hashCode()
{
return Objects.hash(id, owningFolder, inclusionType);
}
}

View File

@@ -53,6 +53,7 @@ import org.alfresco.rest.model.RestRatingModel;
import org.alfresco.rest.model.RestRatingModelsCollection;
import org.alfresco.rest.model.RestRenditionInfoModel;
import org.alfresco.rest.model.RestRenditionInfoModelCollection;
import org.alfresco.rest.model.RestRuleSetLinkModel;
import org.alfresco.rest.model.RestRuleSetModel;
import org.alfresco.rest.model.RestRuleSetModelsCollection;
import org.alfresco.rest.model.RestTagModel;
@@ -1059,4 +1060,10 @@ public class Node extends ModelRequest<Node>
{
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);
}
}