mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
ACS-3723, ACS-3724, ACS-3725 move rules V1 API to private space (#1495)
* ACS-3723: Moving endpoints to private API path. * ACS-3723: Fixes to E2E tests and some other parts. * ACS-3723: Removing unnecessary imports.
This commit is contained in:
@@ -23,12 +23,13 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.api.nodes;
|
||||
package org.alfresco.rest.api.rules;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.api.Rules;
|
||||
import org.alfresco.rest.api.model.rules.RuleExecution;
|
||||
import org.alfresco.rest.api.nodes.NodesEntityResource;
|
||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
@@ -24,7 +24,7 @@
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.nodes;
|
||||
package org.alfresco.rest.api.rules;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -32,6 +32,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.rest.api.RuleSets;
|
||||
import org.alfresco.rest.api.model.rules.RuleSetLink;
|
||||
import org.alfresco.rest.api.nodes.NodesEntityResource;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
||||
import org.alfresco.rest.framework.WebApiParam;
|
||||
import org.alfresco.rest.framework.core.ResourceParameter;
|
@@ -24,12 +24,13 @@
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.nodes;
|
||||
package org.alfresco.rest.api.rules;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.rest.api.RuleSets;
|
||||
import org.alfresco.rest.api.model.rules.RuleSet;
|
||||
import org.alfresco.rest.api.nodes.NodesEntityResource;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
||||
import org.alfresco.rest.framework.core.exceptions.RelationshipResourceNotFoundException;
|
||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
@@ -1,104 +1,105 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* 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.api.nodes;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.rest.api.RuleSettings;
|
||||
import org.alfresco.rest.api.model.rules.RuleSetting;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
||||
import org.alfresco.rest.framework.core.exceptions.RelationshipResourceNotFoundException;
|
||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
/**
|
||||
* Folder node rule settings (rule inheritance).
|
||||
*/
|
||||
@Experimental
|
||||
@RelationshipResource (name = "rule-settings", entityResource = NodesEntityResource.class, title = "Folder rule settings")
|
||||
public class NodeRuleSettingsRelation implements RelationshipResourceAction.ReadById<RuleSetting>,
|
||||
RelationshipResourceAction.Update<RuleSetting>,
|
||||
InitializingBean
|
||||
{
|
||||
private RuleSettings ruleSettings;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception
|
||||
{
|
||||
PropertyCheck.mandatory(this, "ruleSettings", ruleSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the given configuration value for the specified folder.
|
||||
* <p>
|
||||
* - GET /nodes/{folderId}/rule-settings/{ruleSettingKey}
|
||||
*
|
||||
* @param folderId The id of the folder.
|
||||
* @param ruleSettingKey The setting to retrieve.
|
||||
* @param parameters Unused.
|
||||
* @return {@link RuleSetting} The current value of the setting.
|
||||
*/
|
||||
@WebApiDescription (
|
||||
title = "Get a folder node rule setting",
|
||||
description = "Returns the specified rule setting for the given folder",
|
||||
successStatus = HttpServletResponse.SC_OK
|
||||
)
|
||||
@Override
|
||||
public RuleSetting readById(String folderId, String ruleSettingKey, Parameters parameters) throws RelationshipResourceNotFoundException
|
||||
{
|
||||
return ruleSettings.getRuleSetting(folderId, ruleSettingKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of a rule setting for the specified folder.
|
||||
* <p>
|
||||
* PUT /nodes/{folderId}/rule-settings/{ruleSettingKey}
|
||||
*
|
||||
* @param folderId The id of the folder.
|
||||
* @param ruleSetting The new value of the rule setting.
|
||||
* @param parameters Unused.
|
||||
* @return The updated rule setting.
|
||||
*/
|
||||
@WebApiDescription (
|
||||
title = "Update folder node rule setting",
|
||||
description = "Update a rule setting for given node",
|
||||
successStatus = HttpServletResponse.SC_OK
|
||||
)
|
||||
@Override
|
||||
public RuleSetting update(String folderId, RuleSetting ruleSetting, Parameters parameters)
|
||||
{
|
||||
return ruleSettings.setRuleSetting(folderId, ruleSetting);
|
||||
}
|
||||
|
||||
public void setRuleSettings(RuleSettings ruleSettings)
|
||||
{
|
||||
this.ruleSettings = ruleSettings;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* 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.api.rules;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.rest.api.RuleSettings;
|
||||
import org.alfresco.rest.api.model.rules.RuleSetting;
|
||||
import org.alfresco.rest.api.nodes.NodesEntityResource;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
||||
import org.alfresco.rest.framework.core.exceptions.RelationshipResourceNotFoundException;
|
||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
/**
|
||||
* Folder node rule settings (rule inheritance).
|
||||
*/
|
||||
@Experimental
|
||||
@RelationshipResource (name = "rule-settings", entityResource = NodesEntityResource.class, title = "Folder rule settings")
|
||||
public class NodeRuleSettingsRelation implements RelationshipResourceAction.ReadById<RuleSetting>,
|
||||
RelationshipResourceAction.Update<RuleSetting>,
|
||||
InitializingBean
|
||||
{
|
||||
private RuleSettings ruleSettings;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception
|
||||
{
|
||||
PropertyCheck.mandatory(this, "ruleSettings", ruleSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the given configuration value for the specified folder.
|
||||
* <p>
|
||||
* - GET /nodes/{folderId}/rule-settings/{ruleSettingKey}
|
||||
*
|
||||
* @param folderId The id of the folder.
|
||||
* @param ruleSettingKey The setting to retrieve.
|
||||
* @param parameters Unused.
|
||||
* @return {@link RuleSetting} The current value of the setting.
|
||||
*/
|
||||
@WebApiDescription (
|
||||
title = "Get a folder node rule setting",
|
||||
description = "Returns the specified rule setting for the given folder",
|
||||
successStatus = HttpServletResponse.SC_OK
|
||||
)
|
||||
@Override
|
||||
public RuleSetting readById(String folderId, String ruleSettingKey, Parameters parameters) throws RelationshipResourceNotFoundException
|
||||
{
|
||||
return ruleSettings.getRuleSetting(folderId, ruleSettingKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of a rule setting for the specified folder.
|
||||
* <p>
|
||||
* PUT /nodes/{folderId}/rule-settings/{ruleSettingKey}
|
||||
*
|
||||
* @param folderId The id of the folder.
|
||||
* @param ruleSetting The new value of the rule setting.
|
||||
* @param parameters Unused.
|
||||
* @return The updated rule setting.
|
||||
*/
|
||||
@WebApiDescription (
|
||||
title = "Update folder node rule setting",
|
||||
description = "Update a rule setting for given node",
|
||||
successStatus = HttpServletResponse.SC_OK
|
||||
)
|
||||
@Override
|
||||
public RuleSetting update(String folderId, RuleSetting ruleSetting, Parameters parameters)
|
||||
{
|
||||
return ruleSettings.setRuleSetting(folderId, ruleSetting);
|
||||
}
|
||||
|
||||
public void setRuleSettings(RuleSettings ruleSettings)
|
||||
{
|
||||
this.ruleSettings = ruleSettings;
|
||||
}
|
||||
}
|
@@ -24,7 +24,7 @@
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.nodes;
|
||||
package org.alfresco.rest.api.rules;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* 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%
|
||||
*/
|
||||
@WebApi(name="alfresco", scope=Api.SCOPE.PRIVATE, version=1)
|
||||
package org.alfresco.rest.api.rules;
|
||||
import org.alfresco.rest.framework.Api;
|
||||
import org.alfresco.rest.framework.WebApi;
|
@@ -869,7 +869,7 @@
|
||||
<property name="nodeService" ref="NodeService"/>
|
||||
</bean>
|
||||
|
||||
<bean class="org.alfresco.rest.api.nodes.NodeRulesRelation">
|
||||
<bean class="org.alfresco.rest.api.rules.NodeRulesRelation">
|
||||
<property name="rules" ref="Rules" />
|
||||
</bean>
|
||||
|
||||
@@ -902,7 +902,7 @@
|
||||
<property name="ruleMapper" ref="ruleMapper"/>
|
||||
</bean>
|
||||
|
||||
<bean class="org.alfresco.rest.api.nodes.NodeRuleSetsRelation">
|
||||
<bean class="org.alfresco.rest.api.rules.NodeRuleSetsRelation">
|
||||
<property name="ruleSets" ref="RuleSets" />
|
||||
</bean>
|
||||
|
||||
@@ -935,11 +935,11 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean class="org.alfresco.rest.api.nodes.NodeRuleSetLinksRelation">
|
||||
<bean class="org.alfresco.rest.api.rules.NodeRuleSetLinksRelation">
|
||||
<constructor-arg name="ruleSets" ref="RuleSets" />
|
||||
</bean>
|
||||
|
||||
<bean class="org.alfresco.rest.api.nodes.NodeRuleExecutionsRelation">
|
||||
<bean class="org.alfresco.rest.api.rules.NodeRuleExecutionsRelation">
|
||||
<constructor-arg name="rules" ref="Rules" />
|
||||
</bean>
|
||||
|
||||
@@ -958,7 +958,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean class="org.alfresco.rest.api.nodes.NodeRuleSettingsRelation">
|
||||
<bean class="org.alfresco.rest.api.rules.NodeRuleSettingsRelation">
|
||||
<property name="ruleSettings" ref="RuleSettings" />
|
||||
</bean>
|
||||
|
||||
|
@@ -36,7 +36,8 @@ import org.alfresco.rest.api.impl.rules.NodeValidatorTest;
|
||||
import org.alfresco.rest.api.impl.rules.RuleLoaderTest;
|
||||
import org.alfresco.rest.api.impl.rules.RuleSetsImplTest;
|
||||
import org.alfresco.rest.api.impl.rules.RulesImplTest;
|
||||
import org.alfresco.rest.api.nodes.NodeRulesRelationTest;
|
||||
import org.alfresco.rest.api.rules.NodeRuleSetsRelationTest;
|
||||
import org.alfresco.rest.api.rules.NodeRulesRelationTest;
|
||||
import org.alfresco.service.Experimental;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
@@ -45,6 +46,7 @@ import org.junit.runners.Suite;
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
NodeRulesRelationTest.class,
|
||||
NodeRuleSetsRelationTest.class,
|
||||
RulesImplTest.class,
|
||||
RuleSetsImplTest.class,
|
||||
NodeValidatorTest.class,
|
||||
|
@@ -24,7 +24,7 @@
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.nodes;
|
||||
package org.alfresco.rest.api.rules;
|
||||
|
||||
import static org.mockito.BDDMockito.then;
|
||||
|
@@ -24,7 +24,7 @@
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rest.api.nodes;
|
||||
package org.alfresco.rest.api.rules;
|
||||
|
||||
import static org.mockito.BDDMockito.then;
|
||||
|
Reference in New Issue
Block a user