RM-4489 (API: Review period cannot be updated if the review period type and expression are set)

This commit is contained in:
Tuna Aksoy
2016-12-12 16:00:02 +00:00
parent 08cc908c5b
commit 6100204eb3
5 changed files with 705 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
* #L%
*/
package org.alfresco.rest.core;
/**
* FIXME!!!
*
* @author Tuna Aksoy
* @since 2.6
*/
public class ExtendedRestProperties extends RestProperties
{
}

View File

@@ -0,0 +1,33 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
* #L%
*/
package org.alfresco.rest.core;
import org.alfresco.rest.core.RestWrapper;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RestIGCoreAPI;
import org.springframework.beans.factory.annotation.Autowired;
/**
* FIXME!!!
*
* @author Tuna Aksoy
* @since 2.6
*/
public class ExtendedRestWrapper extends RestWrapper
{
@Autowired
private ExtendedRestProperties extendedRestProperties;
public RestIGCoreAPI withIGCoreAPI()
{
return new RestIGCoreAPI(this, extendedRestProperties);
}
}

View File

@@ -0,0 +1,421 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2016 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.rm.community.model.fileplancomponents;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.ALLOWABLE_OPERATIONS;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.IS_CLOSED;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.utility.model.TestModel;
/**
* POJO for file plan component
*
* @author Tuna Aksoy
* @author Rodica Sutu
* @since 2.6
*/
public class FilePlanComponentModel extends TestModel
{
@JsonProperty (required = true)
private String id;
@JsonProperty (required = true)
private String parentId;
@JsonProperty (required = true)
private String name;
@JsonProperty (required = true)
private String nodeType;
@JsonProperty (required = true)
private Boolean isCategory;
@JsonProperty (required = true)
private Boolean isRecordFolder;
@JsonProperty (required = true)
private Boolean isFile;
@JsonProperty
private Boolean hasRetentionSchedule;
@JsonProperty(value = IS_CLOSED)
private Boolean isClosed;
@JsonProperty
private Boolean isCompleted;
@JsonProperty (required = true)
private List<String> aspectNames;
@JsonProperty (required = true)
private FilePlanComponentUserInfo createdByUser;
@JsonProperty(value = PROPERTIES, required = true)
private FilePlanComponentProperties properties;
@JsonProperty (value = ALLOWABLE_OPERATIONS)
private List<String> allowableOperations;
private FilePlanComponentPath path;
@JsonProperty (required = true)
private String modifiedAt;
@JsonProperty (required = true)
private String createdAt;
@JsonProperty (required = true)
private FilePlanComponentUserInfo modifiedByUser;
/**Helper constructor for creating the file plan component using
*
* @param name File Plan Component name
* @param nodeType File Plan Component node type
* @param properties File Plan Component properties
*/
public FilePlanComponentModel(String name, String nodeType, FilePlanComponentProperties properties)
{
this.name = name;
this.nodeType = nodeType;
this.properties = properties;
}
/**
* Helper constructor to create empty file plan component
*/
public FilePlanComponentModel() { }
/**
* Helper constructor for creating the file plan component using
*
* @param name File Plan Component name
*/
public FilePlanComponentModel(String name)
{
this.name = name;
}
/**
* Helper constructor for creating the file plan component using
*
* @param name File Plan Component name
* @param properties File Plan Component properties
*/
public FilePlanComponentModel(String name, FilePlanComponentProperties properties)
{
this.name = name;
this.properties = properties;
}
/**
* @return the id
*/
public String getId()
{
return this.id;
}
/**
* @param id the id to set
*/
public void setId(String id)
{
this.id = id;
}
/**
* @return the parentId
*/
public String getParentId()
{
return this.parentId;
}
/**
* @param parentId the parentId to set
*/
public void setParentId(String parentId)
{
this.parentId = parentId;
}
/**
* @return the name
*/
public String getName()
{
return this.name;
}
/**
* @param name the name to set
*/
public void setName(String name)
{
this.name = name;
}
/**
* @return the nodeType
*/
public String getNodeType()
{
return this.nodeType;
}
/**
* @param nodeType the nodeType to set
*/
public void setNodeType(String nodeType)
{
this.nodeType = nodeType;
}
/**
* @return the isCategory
*/
public Boolean isCategory()
{
return this.isCategory;
}
/**
* @param isCategory the isCategory to set
*/
public void setCategory(Boolean isCategory)
{
this.isCategory = isCategory;
}
/**
* @return the isRecordFolder
*/
public Boolean isRecordFolder()
{
return this.isRecordFolder;
}
/**
* @param isRecordFolder the isRecordFolder to set
*/
public void setRecordFolder(Boolean isRecordFolder)
{
this.isRecordFolder = isRecordFolder;
}
/**
* @return the isFile
*/
public Boolean isFile()
{
return this.isFile;
}
/**
* @param isFile the isFile to set
*/
public void setFile(Boolean isFile)
{
this.isFile = isFile;
}
/**
* @return the hasRetentionSchedule
*/
public Boolean hasRetentionSchedule()
{
return this.hasRetentionSchedule;
}
/**
* @param hasRetentionSchedule the hasRetentionSchedule to set
*/
public void setHasRetentionSchedule(Boolean hasRetentionSchedule)
{
this.hasRetentionSchedule = hasRetentionSchedule;
}
/**
* @return the properties
*/
public FilePlanComponentProperties getProperties()
{
return properties;
}
/**
* @param properties the properties to set
*/
public void setProperties(FilePlanComponentProperties properties)
{
this.properties = properties;
}
/**
* @return the aspectNames
*/
public List<String> getAspectNames()
{
return this.aspectNames;
}
/**
* @param aspectNames the aspectNames to set
*/
public void setAspectNames(List<String> aspectNames)
{
this.aspectNames = aspectNames;
}
/**
* @return the createdByUser
*/
public FilePlanComponentUserInfo getCreatedByUser()
{
return this.createdByUser;
}
/**
* @param createdByUser the createdByUser to set
*/
public void setCreatedByUser(FilePlanComponentUserInfo createdByUser)
{
this.createdByUser = createdByUser;
}
/**
* @return the allowableOperations
*/
public List<String> getAllowableOperations()
{
return this.allowableOperations;
}
/**
* @return the path
*/
public FilePlanComponentPath getPath()
{
return this.path;
}
/**
* @param path the path to set
*/
public void setPath(FilePlanComponentPath path)
{
this.path = path;
}
/**
* @param modifiedAt the modifiedAt to set
*/
public void setModifiedAt(String modifiedAt)
{
this.modifiedAt = modifiedAt;
}
/**
* @param createdAt the createdAt to set
*/
public void setCreatedAt(String createdAt)
{
this.createdAt = createdAt;
}
/**
* @param modifiedByUser the modifiedByUser to set
*/
public void setModifiedByUser(FilePlanComponentUserInfo modifiedByUser)
{
this.modifiedByUser = modifiedByUser;
}
/**
* @return the modifiedAt
*/
public String getModifiedAt()
{
return this.modifiedAt;
}
/**
* @return the createdAt
*/
public String getCreatedAt()
{
return this.createdAt;
}
/**
* @return the modifiedByUser
*/
public FilePlanComponentUserInfo getModifiedByUser()
{
return this.modifiedByUser;
}
/**
* @return the isClosed
*/
public Boolean isClosed()
{
return this.isClosed;
}
/**
* @param closed the isClosed to set
*/
public void setClosed(Boolean closed)
{
this.isClosed = closed;
}
/**
* @return the isCompleted
*/
public Boolean isCompleted()
{
return this.isCompleted;
}
/**
* @param completed the isCompleted to set
*/
public void setCompleted(Boolean completed)
{
this.isCompleted = completed;
}
}

View File

@@ -0,0 +1,183 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
* #L%
*/
package org.alfresco.rest.rm.community.requests;
import static org.alfresco.rest.core.RestRequest.requestWithBody;
import static org.alfresco.rest.core.RestRequest.simpleRequest;
import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject;
import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString;
import static org.alfresco.rest.rm.community.util.PojoUtility.toJson;
import static org.springframework.http.HttpMethod.DELETE;
import static org.springframework.http.HttpMethod.GET;
import static org.springframework.http.HttpMethod.POST;
import static org.springframework.http.HttpMethod.PUT;
import org.alfresco.rest.core.RestWrapper;
import org.alfresco.rest.requests.ModelRequest;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
/**
* FIXME!!!
*
* @author Tuna Aksoy
* @since 2.6
*/
public class FilePlanComponents extends ModelRequest
{
private FilePlanComponentModel filePlanComponentModel;
/**
* @param restWrapper
*/
public FilePlanComponents(FilePlanComponentModel filePlanComponentModel, RestWrapper restWrapper)
{
super(restWrapper);
this.filePlanComponentModel = filePlanComponentModel;
}
/**
* Get a file plan component
*
* @param filePlanComponentId The id of the file plan component to get
* @return The {@link FilePlanComponent} for the given file plan component id
* @throws Exception for the following cases:
* <ul>
* <li>{@code fileplanComponentId} is not a valid format</li>
* <li>authentication fails</li>
* <li>{@code fileplanComponentId} does not exist</li>
* </ul>
*/
public FilePlanComponent getFilePlanComponent(String filePlanComponentId) throws Exception
{
mandatoryString("filePlanComponentId", filePlanComponentId);
/*
return restWrapper.processModel(FilePlanComponent.class, simpleRequest(
GET,
"fileplan-components/{fileplanComponentId}?{parameters}",
filePlanComponentId, getParameters()
*/
// FIXME!!!
return restWrapper.processModel(FilePlanComponent.class, simpleRequest(
GET,
"fileplan-components/{fileplanComponentId}",
filePlanComponentId
));
}
/**
* List child components of a file plan component
*
* @param filePlanComponentId The id of the file plan component of which to get child components
* @return The {@link FilePlanComponent} for the given file plan component id
* @throws Exception for the following cases:
* <ul>
* <li>{@code fileplanComponentId} is not a valid format</li>
* <li>authentication fails</li>
* <li>{@code fileplanComponentId} does not exist</li>
* </ul>
*/
public FilePlanComponentsCollection listChildComponents(String filePlanComponentId) throws Exception
{
mandatoryString("filePlanComponentId", filePlanComponentId);
return restWrapper.processModels(FilePlanComponentsCollection.class, simpleRequest(
GET,
"fileplan-components/{fileplanComponentId}/children",
filePlanComponentId
));
}
/**
* Creates a file plan component with the given properties under the parent node with the given id
*
* @param filePlanComponentModel The properties of the file plan component to be created
* @param parentId The id of the parent where the new file plan component should be created
* @return The {@link FilePlanComponent} with the given properties
* @throws Exception for the following cases:
* <ul>
* <li>{@code fileplanComponentId} is not a valid format</li>
* <li>authentication fails</li>
* <li>current user does not have permission to add children to {@code fileplanComponentId}</li>
* <li>{@code fileplanComponentId} does not exist</li>
* <li>new name clashes with an existing node in the current parent container</li>
* <li>model integrity exception, including node name with invalid characters</li>
* </ul>
*/
public FilePlanComponent createFilePlanComponent(FilePlanComponent filePlanComponentModel, String parentId) throws Exception
{
mandatoryObject("filePlanComponentProperties", filePlanComponentModel);
mandatoryString("parentId", parentId);
return restWrapper.processModel(FilePlanComponent.class, requestWithBody(
POST,
toJson(filePlanComponentModel),
"fileplan-components/{fileplanComponentId}/children",
parentId
));
}
/**
* Updates a file plan component
*
* @param filePlanComponent The properties to be updated
* @param filePlanComponentId The id of the file plan component which will be updated
* @param returns The updated {@link FilePlanComponent}
* @throws Exception for the following cases:
* <ul>
* <li>the update request is invalid or {@code fileplanComponentId} is not a valid format or {@code filePlanComponentProperties} is invalid</li>
* <li>authentication fails</li>
* <li>current user does not have permission to update {@code fileplanComponentId}</li>
* <li>{@code fileplanComponentId} does not exist</li>
* <li>the updated name clashes with an existing node in the current parent folder</li>
* <li>model integrity exception, including node name with invalid characters</li>
* </ul>
*/
public FilePlanComponent updateFilePlanComponent(FilePlanComponent filePlanComponent, String filePlanComponentId) throws Exception
{
mandatoryObject("filePlanComponentProperties", filePlanComponent);
mandatoryString("filePlanComponentId", filePlanComponentId);
return restWrapper.processModel(FilePlanComponent.class, requestWithBody(
PUT,
toJson(filePlanComponent),
"fileplan-components/{fileplanComponentId}",
filePlanComponentId
));
}
/**
* Delete file plan component
*
* @param filePlanComponentId The id of the file plan component to be deleted
* @throws Exception for the following cases:
* <ul>
* <li>{@code fileplanComponentId} is not a valid format</li>
* <li>authentication fails</li>
* <li>current user does not have permission to delete {@code fileplanComponentId}</li>
* <li>{@code fileplanComponentId} does not exist</li>
* <li>{@code fileplanComponentId} is locked and cannot be deleted</li>
* </ul>
*/
public void deleteFilePlanComponent(String filePlanComponentId) throws Exception
{
mandatoryString("filePlanComponentId", filePlanComponentId);
restWrapper.processEmptyModel(simpleRequest(
DELETE,
"fileplan-components/{fileplanComponentId}",
filePlanComponentId
));
}
}

View File

@@ -0,0 +1,45 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
* #L%
*/
package org.alfresco.rest.rm.community.requests.igCoreAPI;
import com.jayway.restassured.RestAssured;
import org.alfresco.rest.core.ExtendedRestProperties;
import org.alfresco.rest.core.RestWrapper;
import org.alfresco.rest.requests.ModelRequest;
/**
* FIXME!!!
*
* @author Tuna Aksoy
* @since 2.6
*/
public class RestIGCoreAPI extends ModelRequest
{
private ExtendedRestProperties extendedRestProperties;
/**
* FIXME!!!
*
* @param restWrapper FIXME!!!
* @param restProperties FIXME!!!
*/
public RestIGCoreAPI(RestWrapper restWrapper, ExtendedRestProperties extendedRestProperties)
{
super(restWrapper);
this.extendedRestProperties = extendedRestProperties;
// FIXME
RestAssured.baseURI = extendedRestProperties.envProperty().getTestServerUrl();
RestAssured.port = extendedRestProperties.envProperty().getPort();
RestAssured.basePath = extendedRestProperties.getRestWorkflowPath();
}
}