Merge branch 'master' into feature/RM-5087_UpdateNotesForGETEndpoints

This commit is contained in:
Ramona Popa
2017-05-17 18:12:09 +03:00
8 changed files with 31 additions and 27 deletions

View File

@@ -64,6 +64,7 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_USER_ID; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_USER_ID;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_CREATION_DATE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_CREATION_DATE;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.rm.community.model.common.Owner; import org.alfresco.rest.rm.community.model.common.Owner;
@@ -86,6 +87,7 @@ import lombok.NoArgsConstructor;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class RecordProperties extends TestModel public class RecordProperties extends TestModel
{ {
/*************************/ /*************************/

View File

@@ -187,7 +187,9 @@ public interface TestData
{ RECORD_CATEGORY_TYPE }, { RECORD_CATEGORY_TYPE },
{ RECORD_FOLDER_TYPE }, { RECORD_FOLDER_TYPE },
{ TRANSFER_CONTAINER_TYPE }, { TRANSFER_CONTAINER_TYPE },
{ UNFILED_CONTAINER_TYPE } { TRANSFER_TYPE },
{ UNFILED_CONTAINER_TYPE },
}; };
} }
} }

View File

@@ -34,6 +34,7 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.IS_CLOSED; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.IS_CLOSED;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FOLDER_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
@@ -105,7 +106,8 @@ public class RecordFolderTests extends BaseRMRestTest
{ UNFILED_CONTAINER_TYPE }, { UNFILED_CONTAINER_TYPE },
{ UNFILED_RECORD_FOLDER_TYPE }, { UNFILED_RECORD_FOLDER_TYPE },
{ TRANSFER_TYPE }, { TRANSFER_TYPE },
{ RECORD_CATEGORY_TYPE } { RECORD_CATEGORY_TYPE },
{ FOLDER_TYPE }
}; };
} }
@@ -370,9 +372,6 @@ public class RecordFolderTests extends BaseRMRestTest
// Make a request to close the record folder // Make a request to close the record folder
RecordFolder updatedRecordFolder = recordFolderAPI.updateRecordFolder(recordFolderModel, recordFolder.getId()); RecordFolder updatedRecordFolder = recordFolderAPI.updateRecordFolder(recordFolderModel, recordFolder.getId());
//FIXME - remove this workaround after RM-4921 is fixed.
updatedRecordFolder = recordFolderAPI.getRecordFolder(updatedRecordFolder.getId());
// Verify that the record folder is closed now // Verify that the record folder is closed now
assertTrue(updatedRecordFolder.getProperties().getIsClosed()); assertTrue(updatedRecordFolder.getProperties().getIsClosed());
@@ -386,9 +385,6 @@ public class RecordFolderTests extends BaseRMRestTest
// Make a request to reopen the record folder // Make a request to reopen the record folder
updatedRecordFolder = recordFolderAPI.updateRecordFolder(recordFolderModel, recordFolder.getId()); updatedRecordFolder = recordFolderAPI.updateRecordFolder(recordFolderModel, recordFolder.getId());
//FIXME - remove this workaround after RM-4921 is fixed.
updatedRecordFolder = recordFolderAPI.getRecordFolder(updatedRecordFolder.getId());
// Verify that the record folder is open now // Verify that the record folder is open now
assertFalse(updatedRecordFolder.getProperties().getIsClosed()); assertFalse(updatedRecordFolder.getProperties().getIsClosed());
} }

View File

@@ -431,7 +431,8 @@ public class UnfiledContainerTests extends BaseRMRestTest
try try
{ {
getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(unfiledFolderModel, UNFILED_RECORDS_CONTAINER_ALIAS); getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(unfiledFolderModel, UNFILED_RECORDS_CONTAINER_ALIAS);
} catch (Exception error) }
catch (Exception error)
{ {
} }
// Verify the status code // Verify the status code

View File

@@ -487,8 +487,10 @@ public class UnfiledRecordsFolderTests extends BaseRMRestTest
assertTrue(record.getName().equals(createdComponent.getName()), assertTrue(record.getName().equals(createdComponent.getName()),
"The record name "+ record.getName()+" is not equal with the record name returned when creating the record " + createdComponent "The record name "+ record.getName()+" is not equal with the record name returned when creating the record " + createdComponent
.getName()); .getName());
String identifier = " \\(" + record.getProperties().getIdentifier() + "\\)";
assertTrue(record.getName().equals(record.getProperties().getIdentifier())); String regex= "(" + NONELECTRONIC_RECORD_NAME + "|" + ELECTRONIC_RECORD_NAME + ")" + "[0-9]+" + identifier;
assertTrue(record.getName().matches(regex),
"The record name:" + record.getName() + " doesn't match the expression " + regex);
assertTrue(createdComponent.getName().contains(createdComponent.getProperties().getIdentifier())); assertTrue(createdComponent.getName().contains(createdComponent.getProperties().getIdentifier()));
assertEquals(createdComponent.getNodeType(), record.getNodeType()); assertEquals(createdComponent.getNodeType(), record.getNodeType());

View File

@@ -39,22 +39,23 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.alfresco.query.PagingResults; import org.alfresco.query.PagingResults;
import org.alfresco.repo.activities.ActivityType;
import org.alfresco.repo.node.getchildren.FilterProp; import org.alfresco.repo.node.getchildren.FilterProp;
import org.alfresco.repo.node.integrity.IntegrityException;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.rest.api.impl.Util; import org.alfresco.rest.api.impl.Util;
import org.alfresco.rest.api.model.UserInfo; import org.alfresco.rest.api.model.UserInfo;
import org.alfresco.rest.framework.WebApiDescription; import org.alfresco.rest.framework.WebApiDescription;
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
import org.alfresco.rest.framework.resource.RelationshipResource; import org.alfresco.rest.framework.resource.RelationshipResource;
import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction;
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction; import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo; import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
import org.alfresco.rest.framework.resource.parameters.Parameters; import org.alfresco.rest.framework.resource.parameters.Parameters;
import org.alfresco.rest.framework.webscripts.WithResponse;
import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory;
import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils;
import org.alfresco.rm.rest.api.impl.SearchTypesFactory; import org.alfresco.rm.rest.api.impl.SearchTypesFactory;
import org.alfresco.rm.rest.api.model.FilePlan; import org.alfresco.rm.rest.api.model.FilePlan;
import org.alfresco.rm.rest.api.model.Record;
import org.alfresco.rm.rest.api.model.RecordCategory; import org.alfresco.rm.rest.api.model.RecordCategory;
import org.alfresco.service.cmr.model.FileFolderService; import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.model.FileInfo; import org.alfresco.service.cmr.model.FileInfo;
@@ -63,6 +64,7 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService; import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.ParameterCheck; import org.alfresco.util.ParameterCheck;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.extensions.webscripts.servlet.FormData;
/** /**
* File plan children relation * File plan children relation
@@ -72,7 +74,9 @@ import org.springframework.beans.factory.InitializingBean;
*/ */
@RelationshipResource(name="categories", entityResource = FilePlanEntityResource.class, title = "Category children of file plan") @RelationshipResource(name="categories", entityResource = FilePlanEntityResource.class, title = "Category children of file plan")
public class FilePlanChildrenRelation implements RelationshipResourceAction.Read<RecordCategory>, public class FilePlanChildrenRelation implements RelationshipResourceAction.Read<RecordCategory>,
RelationshipResourceAction.Create<RecordCategory>, InitializingBean RelationshipResourceAction.Create<RecordCategory>,
MultiPartRelationshipResourceAction.Create<RecordCategory>,
InitializingBean
{ {
/** Record category type */ /** Record category type */
public static final String RECORD_CATEGORY_TYPE = "rma:recordCategory"; public static final String RECORD_CATEGORY_TYPE = "rma:recordCategory";
@@ -218,4 +222,13 @@ public class FilePlanChildrenRelation implements RelationshipResourceAction.Read
return result; return result;
} }
/**
* @see org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction.Create#create(java.lang.String, org.springframework.extensions.webscripts.servlet.FormData, org.alfresco.rest.framework.resource.parameters.Parameters, org.alfresco.rest.framework.webscripts.WithResponse)
*/
@Override
public RecordCategory create(String entityResourceId, FormData formData, Parameters parameters, WithResponse withResponse)
{
throw new IntegrityException("Uploading records into file plan root is not allowed.", null);
}
} }

View File

@@ -30,16 +30,13 @@ package org.alfresco.rm.rest.api.fileplans;
import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank;
import static org.alfresco.util.ParameterCheck.mandatory; import static org.alfresco.util.ParameterCheck.mandatory;
import org.alfresco.repo.node.integrity.IntegrityException;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.rest.framework.WebApiDescription; import org.alfresco.rest.framework.WebApiDescription;
import org.alfresco.rest.framework.WebApiParam; import org.alfresco.rest.framework.WebApiParam;
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
import org.alfresco.rest.framework.resource.EntityResource; import org.alfresco.rest.framework.resource.EntityResource;
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction; import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction;
import org.alfresco.rest.framework.resource.parameters.Parameters; import org.alfresco.rest.framework.resource.parameters.Parameters;
import org.alfresco.rest.framework.webscripts.WithResponse;
import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory;
import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils;
import org.alfresco.rm.rest.api.model.FilePlan; import org.alfresco.rm.rest.api.model.FilePlan;
@@ -50,7 +47,6 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService; import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.ParameterCheck; import org.alfresco.util.ParameterCheck;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.extensions.webscripts.servlet.FormData;
/** /**
* File plan entity resource * File plan entity resource
@@ -61,7 +57,6 @@ import org.springframework.extensions.webscripts.servlet.FormData;
@EntityResource(name = "file-plans", title = "File plans") @EntityResource(name = "file-plans", title = "File plans")
public class FilePlanEntityResource implements EntityResourceAction.ReadById<FilePlan>, public class FilePlanEntityResource implements EntityResourceAction.ReadById<FilePlan>,
EntityResourceAction.Update<FilePlan>, EntityResourceAction.Update<FilePlan>,
MultiPartRelationshipResourceAction.Create<FilePlan>,
InitializingBean InitializingBean
{ {
@@ -153,10 +148,4 @@ public class FilePlanEntityResource implements EntityResourceAction.ReadById<Fil
return nodesModelFactory.createFilePlan(info, parameters, null, false); return nodesModelFactory.createFilePlan(info, parameters, null, false);
} }
@Override
public FilePlan create(String entityResourceId, FormData formData, Parameters parameters, WithResponse withResponse)
{
throw new IntegrityException("Uploading records into file plan root is not allowed.", null);
}
} }

View File

@@ -215,8 +215,7 @@ public class RecordCategoryChildrenRelation implements RelationshipResourceActio
} }
@Override @Override
public RecordCategoryChild create(String entityResourceId, FormData formData, Parameters parameters, public RecordCategoryChild create(String entityResourceId, FormData formData, Parameters parameters, WithResponse withResponse)
WithResponse withResponse)
{ {
throw new IntegrityException("Uploading records into record categories is not allowed.", null); throw new IntegrityException("Uploading records into record categories is not allowed.", null);
} }