Feature/rm 4639 rest api refactoring 2

This commit is contained in:
Tuna Aksoy
2017-04-12 07:36:12 +01:00
committed by Ramona Popa
parent a2a0a12bea
commit 62a01f103f
154 changed files with 18151 additions and 7134 deletions

View File

@@ -30,12 +30,15 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import lombok.Getter;
/**
* Extends {@link RestProperties} to be able to change/add properties
*
* @author Tuna Aksoy
* @since 2.6
*/
@Getter
@Configuration
@PropertySource(value = {"classpath:default.properties", "classpath:config.properties"})
@PropertySource(value = "classpath:module.properties", ignoreResourceNotFound = true)
@@ -53,36 +56,4 @@ public class RMRestProperties extends RestProperties
@Value ("${rest.rmPath}")
private String restRmPath;
/**
* @return the scheme
*/
public String getScheme()
{
return this.scheme;
}
/**
* @return the server
*/
public String getServer()
{
return this.server;
}
/**
* @return the port
*/
public String getPort()
{
return this.port;
}
/**
* @return the restRmPath
*/
public String getRestRmPath()
{
return this.restRmPath;
}
}

View File

@@ -34,15 +34,17 @@ import org.alfresco.rest.model.RestHtmlResponse;
import org.alfresco.rest.model.RestSiteModel;
import org.alfresco.rest.model.RestSiteModelsCollection;
import org.alfresco.rest.requests.coreAPI.RestCoreAPI;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RestIGCoreAPI;
import org.alfresco.rest.rm.community.requests.gscore.GSCoreAPI;
import org.alfresco.utility.model.UserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import lombok.Getter;
/**
* Extends {@link RestWrapper} in order to call IG APIs with our own properties
* Extends {@link RestWrapper} in order to call GS APIs with our own properties
*
* @author Tuna Aksoy
* @since 2.6
@@ -54,12 +56,14 @@ public class RMRestWrapper
/** The class that wraps the ReST APIs from core. */
@Autowired
private RestWrapper restWrapper;
@Autowired
@Getter
private RMRestProperties rmRestProperties;
public RestIGCoreAPI withIGCoreAPI()
public GSCoreAPI withGSCoreAPI()
{
return new RestIGCoreAPI(this, rmRestProperties);
return new GSCoreAPI(this, getRmRestProperties());
}
/** Get the core class that wraps the ReST APIs. */
@@ -159,12 +163,4 @@ public class RMRestWrapper
{
return restWrapper.processHtmlResponse(simpleRequest);
}
/**
* @return the rmRestProperties
*/
public RMRestProperties getRmRestProperties()
{
return this.rmRestProperties;
}
}

View File

@@ -26,16 +26,24 @@
*/
package org.alfresco.rest.core;
import static lombok.AccessLevel.PROTECTED;
import javax.annotation.Resource;
import org.alfresco.rest.requests.Node;
import org.alfresco.rest.requests.coreAPI.RestCoreAPI;
import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
import org.alfresco.rest.rm.community.requests.igCoreAPI.FilesAPI;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RMSiteAPI;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RMUserAPI;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RecordsAPI;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RestIGCoreAPI;
import org.alfresco.rest.rm.community.requests.gscore.GSCoreAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.FilePlanAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.FilesAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RMUserAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.TransferAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.TransferContainerAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.model.RepoTestModel;
import org.alfresco.utility.model.UserModel;
@@ -43,8 +51,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import lombok.Getter;
import lombok.Setter;
/**
* REST API Factory Implementation
* REST API Factory which provides access to the APIs
*
* @author Tuna Aksoy
* @since 2.6
@@ -54,93 +65,143 @@ import org.springframework.stereotype.Service;
public class RestAPIFactory
{
@Autowired
@Getter (value = PROTECTED)
private DataUser dataUser;
@Resource(name = "RMRestWrapper")
@Getter
@Setter
private RMRestWrapper rmRestWrapper;
/**
* @return the rmRestWrapper
*/
public RMRestWrapper getRmRestWrapper()
private GSCoreAPI getGSCoreAPI(UserModel userModel)
{
return this.rmRestWrapper;
getRmRestWrapper().authenticateUser(userModel != null ? userModel : getDataUser().getAdminUser());
return getRmRestWrapper().withGSCoreAPI();
}
public void setRmRestWrapper(RMRestWrapper rmRestWrapper)
private RestCoreAPI getCoreAPI(UserModel userModel)
{
this.rmRestWrapper = rmRestWrapper;
}
private RestIGCoreAPI getRestIGCoreAPI(UserModel userModel)
{
getRmRestWrapper().authenticateUser(userModel != null ? userModel : dataUser.getAdminUser());
return getRmRestWrapper().withIGCoreAPI();
}
private RestCoreAPI getRestCoreAPI(UserModel userModel)
{
getRmRestWrapper().authenticateUser(userModel != null ? userModel : dataUser.getAdminUser());
getRmRestWrapper().authenticateUser(userModel != null ? userModel : getDataUser().getAdminUser());
return getRmRestWrapper().withCoreAPI();
}
public Node getNodeAPI(RepoTestModel model) throws Exception
{
return getRestCoreAPI(null).usingNode(model);
return getCoreAPI(null).usingNode(model);
}
public Node getNodeAPI(UserModel userModel, RepoTestModel model) throws Exception
{
return getRestCoreAPI(userModel).usingNode(model);
return getCoreAPI(userModel).usingNode(model);
}
public RMSiteAPI getRMSiteAPI()
{
return getRestIGCoreAPI(null).usingRMSite();
return getGSCoreAPI(null).usingRMSite();
}
public RMSiteAPI getRMSiteAPI(UserModel userModel)
{
return getRestIGCoreAPI(userModel).usingRMSite();
return getGSCoreAPI(userModel).usingRMSite();
}
public FilePlanComponentAPI getFilePlanComponentsAPI()
public FilePlanAPI getFilePlansAPI()
{
return getRestIGCoreAPI(null).usingFilePlanComponents();
return getGSCoreAPI(null).usingFilePlans();
}
public FilePlanComponentAPI getFilePlanComponentsAPI(UserModel userModel)
public FilePlanAPI getFilePlansAPI(UserModel userModel)
{
return getRestIGCoreAPI(userModel).usingFilePlanComponents();
return getGSCoreAPI(userModel).usingFilePlans();
}
public RecordCategoryAPI getRecordCategoryAPI()
{
return getGSCoreAPI(null).usingRecordCategory();
}
public RecordCategoryAPI getRecordCategoryAPI(UserModel userModel)
{
return getGSCoreAPI(userModel).usingRecordCategory();
}
public RecordFolderAPI getRecordFolderAPI()
{
return getGSCoreAPI(null).usingRecordFolder();
}
public RecordFolderAPI getRecordFolderAPI(UserModel userModel)
{
return getGSCoreAPI(userModel).usingRecordFolder();
}
public RecordsAPI getRecordsAPI()
{
return getRestIGCoreAPI(null).usingRecords();
return getGSCoreAPI(null).usingRecords();
}
public RecordsAPI getRecordsAPI(UserModel userModel)
{
return getRestIGCoreAPI(userModel).usingRecords();
return getGSCoreAPI(userModel).usingRecords();
}
public FilesAPI getFilesAPI()
{
return getRestIGCoreAPI(null).usingFiles();
return getGSCoreAPI(null).usingFiles();
}
public FilesAPI getFilesAPI(UserModel userModel)
{
return getRestIGCoreAPI(userModel).usingFiles();
return getGSCoreAPI(userModel).usingFiles();
}
public TransferContainerAPI getTransferContainerAPI()
{
return getGSCoreAPI(null).usingTransferContainer();
}
public TransferContainerAPI getTransferContainerAPI(UserModel userModel)
{
return getGSCoreAPI(userModel).usingTransferContainer();
}
public TransferAPI getTransferAPI()
{
return getGSCoreAPI(null).usingTransfer();
}
public TransferAPI getTransferAPI(UserModel userModel)
{
return getGSCoreAPI(userModel).usingTransfer();
}
public RMUserAPI getRMUserAPI()
{
return getRestIGCoreAPI(null).usingRMUser();
return getGSCoreAPI(null).usingRMUser();
}
public RMUserAPI getRMUserAPI(UserModel userModel)
{
return getRestIGCoreAPI(userModel).usingRMUser();
return getGSCoreAPI(userModel).usingRMUser();
}
public UnfiledContainerAPI getUnfiledContainersAPI()
{
return getGSCoreAPI(null).usingUnfiledContainers();
}
public UnfiledContainerAPI getUnfiledContainersAPI(UserModel userModel)
{
return getGSCoreAPI(userModel).usingUnfiledContainers();
}
public UnfiledRecordFolderAPI getUnfiledRecordFoldersAPI()
{
return getGSCoreAPI(null).usingUnfiledRecordFolder();
}
public UnfiledRecordFolderAPI getUnfiledRecordFoldersAPI(UserModel userModel)
{
return getGSCoreAPI(userModel).usingUnfiledRecordFolder();
}
}

View File

@@ -24,7 +24,9 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.rm.community.model.fileplancomponents;
package org.alfresco.rest.rm.community.model.common;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -41,8 +43,11 @@ import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FilePlanComponentIdNamePair
public class IdNamePair
{
public String id;
public String name;
@JsonProperty (required = true)
private String id;
@JsonProperty (required = true)
private String name;
}

View File

@@ -24,25 +24,26 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.rm.community.model.fileplancomponents;
package org.alfresco.rest.rm.community.model.common;
import org.alfresco.utility.model.TestModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
/**
* POJO for file plan component created by object
* POJO for owner parameter
*
* @author Kristijan Conkas
* @author Tuna Aksoy
* @since 2.6
*/
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FilePlanComponentUserInfo
@EqualsAndHashCode(callSuper = true)
//@NoArgsConstructor
//@AllArgsConstructor
public class Owner extends TestModel
{
private String id;
private String displayName;
}

View File

@@ -24,31 +24,39 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.rm.community.model.fileplancomponents;
package org.alfresco.rest.rm.community.model.common;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.utility.model.TestModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for FilePlanComponent path parameter
* POJO for path parameter
*
* @author Kristijan Conkas
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class FilePlanComponentPath
public class Path extends TestModel
{
@JsonProperty (required = true)
private String name;
@JsonProperty (required = true)
private Boolean isComplete;
private List<FilePlanComponentIdNamePair> elements;
@JsonProperty (required = true)
private List<IdNamePair> elements;
}

View File

@@ -24,7 +24,9 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.rm.community.model.fileplancomponents;
package org.alfresco.rest.rm.community.model.common;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -32,7 +34,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
/**
* POJO for the file plan component review period
* POJO for the review period parameter
*
* @author Rodica Sutu
* @since 2.6
@@ -41,8 +43,11 @@ import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FilePlanComponentReviewPeriod
public class ReviewPeriod
{
@JsonProperty (required = true)
private String periodType;
@JsonProperty (required = true)
private String expression;
}

View File

@@ -0,0 +1,99 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.fileplan;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.model.RestByUserModel;
import org.alfresco.rest.rm.community.model.common.Path;
import org.alfresco.utility.model.TestModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for file plan
*
* @author Ramona Popa
* @author Tuna Aksoy
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class FilePlan extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true)
private RestByUserModel createdByUser;
@JsonProperty (required = true)
private String modifiedAt;
@JsonProperty (required = true)
private String nodeType;
@JsonProperty (required = true)
private String parentId;
@JsonProperty (required = true)
private List<String> aspectNames;
@JsonProperty (required = true)
private String createdAt;
@JsonProperty (required = true)
private RestByUserModel modifiedByUser;
@JsonProperty (required = true)
private String name;
@JsonProperty (required = true)
private String id;
@JsonProperty (required = true)
private FilePlanProperties properties;
/************************/
/** Optional parameters */
/************************/
@JsonProperty
private List<String> allowableOperations;
@JsonProperty
private Path path;
}

View File

@@ -0,0 +1,78 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.fileplan;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_COMPONENT_ID;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_COUNT;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ID_IS_TEMPORARILY_EDITABLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.utility.model.TestModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for file plan properties
*
* @author Tuna Aksoy
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class FilePlanProperties extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true, value = PROPERTIES_ID_IS_TEMPORARILY_EDITABLE)
private Boolean idIsTemporarilyEditable;
@JsonProperty (required = true, value = PROPERTIES_IDENTIFIER)
private String identifier;
@JsonProperty (required = true, value = PROPERTIES_COMPONENT_ID)
private String componentd;
@JsonProperty (required = true, value = PROPERTIES_ROOT_NODE_REF)
private String rootNodeRef;
/************************/
/** Optional parameters */
/************************/
@JsonProperty (PROPERTIES_COUNT)
private Integer count;
}

View File

@@ -37,5 +37,4 @@ public class FilePlanComponentAlias
public static final String FILE_PLAN_ALIAS = "-filePlan-";
public static final String TRANSFERS_ALIAS = "-transfers-";
public static final String UNFILED_RECORDS_CONTAINER_ALIAS = "-unfiled-";
public static final String HOLDS_ALIAS = "-holds-";
}

View File

@@ -34,6 +34,6 @@ package org.alfresco.rest.rm.community.model.fileplancomponents;
*/
public class FilePlanComponentAspects
{
// aspect present on closed records
public static final String ASPECTS_CLOSED_RECORD = "rma:declaredRecord";
// aspect present on completed records
public static final String ASPECTS_COMPLETED_RECORD = "rma:declaredRecord";
}

View File

@@ -34,33 +34,85 @@ package org.alfresco.rest.rm.community.model.fileplancomponents;
*/
public class FilePlanComponentFields
{
public static final String NAME = "name";
public static final String NODE_TYPE = "nodeType";
public static final String NODE_PARENT_ID = "parentId";
public static final String ENTRY = "entry";
public static final String PROPERTIES = "properties";
/** Common properties for file plans, record categories, record folders and records */
public static final String PROPERTIES_ROOT_NODE_REF = "rma:rootNodeRef";
public static final String PROPERTIES_IDENTIFIER = "rma:identifier";
public static final String PROPERTIES_ID_IS_TEMPORARILY_EDITABLE = "rma:idIsTemporarilyEditable";
/** Common properties for record categories, record folders and records */
// Non-electronic record properties
public static final String PROPERTIES_TITLE = "cm:title";
public static final String PROPERTIES_RECORD_ID = "rma:identifier";
public static final String PROPERTIES_VITAL_RECORD_INDICATOR = "rma:vitalRecordIndicator";
public static final String PROPERTIES_HOLD_REASON = "rma:holdReason";
public static final String PROPERTIES_DESCRIPTION = "cm:description";
public static final String PROPERTIES_SUPPLEMENTAL_MARKING_LIST = "rmc:supplementalMarkingList";
public static final String ALLOWABLE_OPERATIONS = "allowableOperations";
public static final String IS_CLOSED = "isClosed";
/** Common properties for record categories and record folders **/
public static final String PROPERTIES_VITAL_RECORD_INDICATOR = "rma:vitalRecordIndicator";
public static final String PROPERTIES_REVIEW_PERIOD = "rma:reviewPeriod";
public static final String PROPERTIES_LOCATION = "rma:location";
public static final String PROPERTIES_OWNER = "cm:owner";
/** Common properties for record folders and records */
public static final String PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE = "rma:recordSearchHasDispositionSchedule";
/** File plan properties */
public static final String PROPERTIES_COMPONENT_ID = "st:componentId";
public static final String PROPERTIES_COUNT = "rma:count";
/** Record category properties */
// All fields are shared with record folders
/** Record folder properties */
public static final String PROPERTIES_IS_CLOSED = "rma:isClosed"; // not to be confused with IS_CLOSED!
public static final String IS_COMPLETED = "isCompleted";
// for non-electronic records
public static final String PROPERTIES_BOX = "rma:box";
public static final String PROPERTIES_FILE = "rma:file";
public static final String PROPERTIES_NUMBER_OF_COPIES = "rma:numberOfCopies";
public static final String PROPERTIES_PHYSICAL_SIZE = "rma:physicalSize";
public static final String PROPERTIES_HELD_CHILDREN_COUNT = "rma:heldChildrenCount";
public static final String PROPERTIES_LOCATION = "rma:location";
public static final String PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD = "rma:recordSearchVitalRecordReviewPeriod";
public static final String PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION = "rma:recordSearchVitalRecordReviewPeriodExpression";
/** Record properties */
public static final String PROPERTIES_DATE_FILED = "rma:dateFiled";
public static final String PROPERTIES_ORIGINAL_NAME = "rma:origionalName";
/** Electronic record properties */
public static final String PROPERTIES_VERSION_TYPE = "cm:versionType";
public static final String PROPERTIES_VERSION_LABEL = "cm:versionLabel";
public static final String PROPERTIES_DATE_TIME_ORIGINAL = "exif:dateTimeOriginal";
public static final String PROPERTIES_EXPOSURE_TIME = "exif:exposureTime";
public static final String PROPERTIES_FLASH = "exif:flash";
public static final String PROPERTIES_F_NUMBER = "exif:fNumber";
public static final String PROPERTIES_FOCAL_LENGTH = "exif:focalLength";
public static final String PROPERTIES_ISO_SPEED_RATINGS = "exif:isoSpeedRatings";
public static final String PROPERTIES_MANUFACTURER = "exif:manufacturer";
public static final String PROPERTIES_MODEL = "exif:model";
public static final String PROPERTIES_ORIENTATION = "exif:orientation";
public static final String PROPERTIES_PIXEL_X_DIMENSION = "exif:pixelXDimension";
public static final String PROPERTIES_PIXEL_Y_DIMENSION = "exif:pixelYDimension";
public static final String PROPERTIES_RESOLUTION_UNIT = "exif:resolutionUnit";
public static final String PROPERTIES_SOFTWARE = "exif:software";
public static final String PROPERTIES_X_RESOLUTION = "exif:xResolution";
public static final String PROPERTIES_Y_RESOLUTION = "exif:yResolution";
public static final String PROPERTIES_RECORD_ORIGINATING_LOCATION = "rma:recordOriginatingLocation";
public static final String PROPERTIES_RECORD_ORIGINATING_USER_ID = "rma:recordOriginatingUserId";
public static final String PROPERTIES_RECORD_ORIGINATING_CREATION_DATE = "rma:recordOriginatingCreationDate";
/** Non-electronic record properties */
public static final String PROPERTIES_SHELF = "rma:shelf";
public static final String PROPERTIES_STORAGE_LOCATION = "rma:storageLocation";
public static final String PROPERTIES_FILE = "rma:file";
public static final String PROPERTIES_BOX = "rma:box";
public static final String PROPERTIES_NUMBER_OF_COPIES = "rma:numberOfCopies";
public static final String PROPERTIES_PHYSICAL_SIZE = "rma:physicalSize";
//RelativePath specifies the container structure to create relative to the nodeId.
/** Transfer properties */
public static final String PROPERTIES_PDF_INDICATOR = "rma:transferPDFIndicator";
public static final String PROPERTIES_TRANSFER_LOCATION = "rma:transferLocation";
public static final String PROPERTIES_ACCESSION_INDICATOR = "rma:transferAccessionIndicator";
/** Parameters */
public static final String RELATIVE_PATH = "relativePath";
public static final String INCLUDE = "include";
/** Include options */
public static final String ALLOWABLE_OPERATIONS = "allowableOperations";
public static final String IS_CLOSED = "isClosed";
public static final String IS_COMPLETED = "isCompleted";
public static final String CONTENT = "content";
public static final String PATH = "path";
}

View File

@@ -38,9 +38,7 @@ public class FilePlanComponentType
public static final String RECORD_CATEGORY_TYPE = "rma:recordCategory";
public static final String RECORD_FOLDER_TYPE = "rma:recordFolder";
public static final String RECORD_TYPE = "rma:record"; // generic record type
public static final String HOLD_TYPE = "rma:hold";
public static final String UNFILED_RECORD_FOLDER_TYPE = "rma:unfiledRecordFolder";
public static final String HOLD_CONTAINER_TYPE = "rma:holdContainer";
public static final String TRANSFER_TYPE = "rma:transfer";
public static final String TRANSFER_CONTAINER_TYPE = "rma:transferContainer";
public static final String UNFILED_CONTAINER_TYPE = "rma:unfiledRecordContainer";

View File

@@ -0,0 +1,103 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.record;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.model.RestByUserModel;
import org.alfresco.rest.rm.community.model.common.Path;
import org.alfresco.utility.model.TestModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for record
*
* @author Tuna Aksoy
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class Record extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true)
private String createdAt;
@JsonProperty (required = true)
private RestByUserModel createdByUser;
@JsonProperty (required = true)
private String modifiedAt;
@JsonProperty (required = true)
private RestByUserModel modifiedByUser;
@JsonProperty (required = true)
private String name;
@JsonProperty (required = true)
private String id;
@JsonProperty (required = true)
private String nodeType;
@JsonProperty (required = true)
private String parentId;
/************************/
/** Optional parameters */
/************************/
@JsonProperty
private RecordContent content;
@JsonProperty
private Boolean isCompleted;
@JsonProperty
private RecordProperties properties;
@JsonProperty
private List<String> aspectNames;
@JsonProperty
private List<String> allowableOperations;
@JsonProperty
private Path path;
}

View File

@@ -24,16 +24,17 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.rm.community.model.fileplancomponents;
package org.alfresco.rest.rm.community.model.record;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.utility.model.TestModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.alfresco.utility.model.TestModel;
/**
* POJO for File records
@@ -43,14 +44,11 @@ import org.alfresco.utility.model.TestModel;
*/
@Builder
@Data
@EqualsAndHashCode (callSuper = true)
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class RecordBodyFile extends TestModel
{
@JsonProperty
private String targetParentId;
@JsonProperty
private String relativePath;
}

View File

@@ -24,30 +24,32 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.rm.community.model.fileplancomponents;
package org.alfresco.rest.rm.community.model.record;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.utility.model.TestModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for FilePlanComponent content field
* POJO for record content field
*
* @author Kristijan Conkas
* @author Tuna Aksoy
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class FilePlanComponentContent
public class RecordContent extends TestModel
{
@JsonProperty (required = true)
private String encoding;
@JsonProperty (required = true)
private String mimeType;
@@ -56,4 +58,7 @@ public class FilePlanComponentContent
@JsonProperty (required = true)
private Integer sizeInBytes;
@JsonProperty (required = true)
private String encoding;
}

View File

@@ -0,0 +1,203 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.record;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_BOX;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DATE_FILED;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DATE_TIME_ORIGINAL;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_EXPOSURE_TIME;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FILE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FLASH;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FOCAL_LENGTH;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_F_NUMBER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ID_IS_TEMPORARILY_EDITABLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ISO_SPEED_RATINGS;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_MANUFACTURER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_MODEL;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_NUMBER_OF_COPIES;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ORIENTATION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ORIGINAL_NAME;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PHYSICAL_SIZE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PIXEL_X_DIMENSION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PIXEL_Y_DIMENSION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RESOLUTION_UNIT;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SHELF;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SOFTWARE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_STORAGE_LOCATION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VERSION_LABEL;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VERSION_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_X_RESOLUTION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_Y_RESOLUTION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_LOCATION;
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 com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.rm.community.model.common.Owner;
import org.alfresco.utility.model.TestModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for record properties
*
* @author Tuna Aksoy
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class RecordProperties extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true, value = PROPERTIES_ROOT_NODE_REF)
private String rootNodeRef;
@JsonProperty (required = true, value = PROPERTIES_DATE_FILED)
private String dateField;
@JsonProperty (required = true, value = PROPERTIES_IDENTIFIER)
private String identifier;
@JsonProperty (required = true, value = PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE)
private Boolean recordSearchHasDispositionSchedule;
@JsonProperty (required = true, value = PROPERTIES_ORIGINAL_NAME)
private String originalName;
@JsonProperty (required = true, value = PROPERTIES_ID_IS_TEMPORARILY_EDITABLE)
private Boolean idIsTemporarilyEditable;
/*********************************/
/** Electronic record parameters */
/*********************************/
@JsonProperty (PROPERTIES_VERSION_TYPE)
private String versionType;
@JsonProperty (PROPERTIES_VERSION_LABEL)
private String versionLabel;
@JsonProperty (PROPERTIES_DATE_TIME_ORIGINAL)
private String dateTimeOriginal;
@JsonProperty (PROPERTIES_EXPOSURE_TIME)
private Double exposureTime;
@JsonProperty (PROPERTIES_FLASH)
private Boolean flash;
@JsonProperty (PROPERTIES_F_NUMBER)
private Double fNumber;
@JsonProperty (PROPERTIES_FOCAL_LENGTH)
private Double focalLength;
@JsonProperty (PROPERTIES_ISO_SPEED_RATINGS)
private Integer isoSpeedRatings;
@JsonProperty (PROPERTIES_MANUFACTURER)
private String manufacturer;
@JsonProperty (PROPERTIES_MODEL)
private String model;
@JsonProperty (PROPERTIES_ORIENTATION)
private Integer orientation;
@JsonProperty (PROPERTIES_PIXEL_X_DIMENSION)
private Integer pixelXDimension;
@JsonProperty (PROPERTIES_PIXEL_Y_DIMENSION)
private Integer pixelYDimension;
@JsonProperty (PROPERTIES_RESOLUTION_UNIT)
private String resolutionUnit;
@JsonProperty (PROPERTIES_SOFTWARE)
private String software;
@JsonProperty (PROPERTIES_X_RESOLUTION)
private Double xResolution;
@JsonProperty (PROPERTIES_Y_RESOLUTION)
private Double yResolution;
@JsonProperty (PROPERTIES_RECORD_ORIGINATING_LOCATION)
private String originatingLocation;
@JsonProperty (PROPERTIES_RECORD_ORIGINATING_USER_ID)
private String originatingUserId;
@JsonProperty (PROPERTIES_RECORD_ORIGINATING_CREATION_DATE)
private String originatingCreationDate;
/*************************************/
/** Non-electronic record parameters */
/*************************************/
@JsonProperty (PROPERTIES_TITLE)
private String title;
@JsonProperty (PROPERTIES_SHELF)
private String shelf;
@JsonProperty (PROPERTIES_STORAGE_LOCATION)
private String storageLocation;
@JsonProperty (PROPERTIES_FILE)
private String file;
@JsonProperty (PROPERTIES_BOX)
private String box;
@JsonProperty (PROPERTIES_DESCRIPTION)
private String description;
@JsonProperty (PROPERTIES_NUMBER_OF_COPIES)
private Integer numberOfCopies;
@JsonProperty (PROPERTIES_PHYSICAL_SIZE)
private Integer physicalSize;
@JsonProperty (PROPERTIES_OWNER)
private Owner owner;
}

View File

@@ -0,0 +1,101 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.recordcategory;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.model.RestByUserModel;
import org.alfresco.rest.rm.community.model.common.Path;
import org.alfresco.utility.model.TestModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for record category
*
* @author Tuna Aksoy
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class RecordCategory extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true)
private RestByUserModel createdByUser;
@JsonProperty (required = true)
private String modifiedAt;
@JsonProperty (required = true)
private String nodeType;
@JsonProperty (required = true)
private String parentId;
@JsonProperty (required = true)
private List<String> aspectNames;
@JsonProperty (required = true)
private String createdAt;
@JsonProperty (required = true)
private RestByUserModel modifiedByUser;
@JsonProperty (required = true)
private String name;
@JsonProperty (required = true)
private String id;
@JsonProperty (required = true)
private RecordCategoryProperties properties;
/************************/
/** Optional parameters */
/************************/
@JsonProperty
private Boolean hasRetentionSchedule;
@JsonProperty
private List<String> allowableOperations;
@JsonProperty
private Path path;
}

View File

@@ -0,0 +1,112 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.recordcategory;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.model.RestByUserModel;
import org.alfresco.rest.rm.community.model.common.Path;
import org.alfresco.utility.model.TestModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for record category child
*
* @author Tuna Aksoy
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class RecordCategoryChild extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true)
private String createdAt;
@JsonProperty (required = true)
private RestByUserModel createdByUser;
@JsonProperty (required = true)
private String modifiedAt;
@JsonProperty (required = true)
private RestByUserModel modifiedByUser;
@JsonProperty (required = true)
private String name;
@JsonProperty (required = true)
private String id;
@JsonProperty (required = true)
private String nodeType;
@JsonProperty (required = true)
private String parentId;
/************************/
/** Optional parameters */
/************************/
@JsonProperty
private Boolean isRecordCategory;
@JsonProperty
private Boolean isRecordFolder;
@JsonProperty
private RecordCategoryChildProperties properties;
@JsonProperty
private List<String> aspectNames;
@JsonProperty
private Boolean hasRetentionSchedule;
@JsonProperty
private Boolean isClosed;
@JsonProperty
private List<String> allowableOperations;
@JsonProperty
private Path path;
@JsonProperty
private String relativePath;
}

View File

@@ -0,0 +1,41 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.recordcategory;
import org.alfresco.rest.core.RestModels;
/**
* Handle collection of {@link RecordCategoryChildEntry}
*
* @author Kristijan Conkas
* @author Tuna Aksoy
* @since 2.6
*/
public class RecordCategoryChildCollection extends RestModels<RecordCategoryChildEntry, RecordCategoryChildCollection>
{
}

View File

@@ -0,0 +1,48 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.recordcategory;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.RestModels;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* POJO for record category child entry
*
* @author Tuna Aksoy
* @since 2.6
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class RecordCategoryChildEntry extends RestModels<RecordCategory, RecordCategoryChildEntry>
{
@JsonProperty
private RecordCategoryChild entry;
}

View File

@@ -24,90 +24,83 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.rm.community.model.fileplancomponents;
package org.alfresco.rest.rm.community.model.recordcategory;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_BOX;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FILE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_HOLD_REASON;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_HELD_CHILDREN_COUNT;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ID_IS_TEMPORARILY_EDITABLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IS_CLOSED;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_LOCATION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_NUMBER_OF_COPIES;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PHYSICAL_SIZE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_PERIOD;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SHELF;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SUPPLEMENTAL_MARKING_LIST;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ID;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.alfresco.rest.rm.community.model.common.ReviewPeriod;
import org.alfresco.rest.rm.community.util.ReviewPeriodSerializer;
import org.alfresco.utility.model.TestModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for file plan component properties
* POJO for record category child properties
*
* @author Kristijan Conkas
* @author Tuna Aksoy
* @since 2.6
*/
//FIXME: Once the fields have been added the JsonIgnoreProperties annotation should be removed
@JsonIgnoreProperties (ignoreUnknown = true)
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class FilePlanComponentProperties
public class RecordCategoryChildProperties extends TestModel
{
@JsonProperty(PROPERTIES_VITAL_RECORD_INDICATOR)
private Boolean vitalRecord;
@JsonProperty(PROPERTIES_TITLE)
/**************************************************************************/
/** Mandatory parameters - Shared by record categories and record folders */
/**************************************************************************/
@JsonProperty (required = true, value = PROPERTIES_TITLE)
private String title;
@JsonProperty(PROPERTIES_HOLD_REASON)
private String holdReason;
@JsonProperty (required = true, value = PROPERTIES_VITAL_RECORD_INDICATOR)
private Boolean vitalRecordIndicator;
@JsonProperty(PROPERTIES_DESCRIPTION)
@JsonProperty (required = true, value = PROPERTIES_ROOT_NODE_REF)
private String rootNodeRef;
@JsonProperty (required = true, value = PROPERTIES_ID_IS_TEMPORARILY_EDITABLE)
private Boolean idIsTemporarilyEditable;
@JsonProperty (required = true, value = PROPERTIES_IDENTIFIER)
private String identifier;
@JsonProperty (required = true, value = PROPERTIES_REVIEW_PERIOD)
@JsonSerialize (using = ReviewPeriodSerializer.class)
private ReviewPeriod reviewPeriod;
@JsonProperty (required = true, value = PROPERTIES_DESCRIPTION)
private String description;
@JsonProperty(PROPERTIES_SUPPLEMENTAL_MARKING_LIST)
private List<String> supplementalMarkingList;
/*********************************************************/
/** Optional parameters - Applies only to record folders */
/*********************************************************/
@JsonProperty (PROPERTIES_HELD_CHILDREN_COUNT)
private Integer heldChildrenCount;
@JsonProperty(PROPERTIES_REVIEW_PERIOD)
@JsonSerialize (using = ReviewPeriodSerializer.class)
private FilePlanComponentReviewPeriod reviewPeriod;
@JsonProperty(PROPERTIES_LOCATION)
@JsonProperty (PROPERTIES_LOCATION)
private String location;
@JsonProperty(value = PROPERTIES_IS_CLOSED, required = false)
@JsonProperty (PROPERTIES_IS_CLOSED)
private Boolean isClosed;
@JsonProperty(value = PROPERTIES_BOX, required = false)
private String box;
@JsonProperty(value = PROPERTIES_FILE, required = false)
private String file;
@JsonProperty(value = PROPERTIES_SHELF, required = false)
private String shelf;
@JsonProperty(value = PROPERTIES_NUMBER_OF_COPIES, required = false)
private Integer numberOfCopies;
@JsonProperty(value = PROPERTIES_PHYSICAL_SIZE, required = false)
private Integer physicalSize;
@JsonProperty(value = PROPERTIES_RECORD_ID, required = false)
private String rmIdentifier;
}
@JsonProperty (PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE)
private Boolean recordSearchHasDispositionSchedule;
}

View File

@@ -0,0 +1,41 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.recordcategory;
import org.alfresco.rest.core.RestModels;
/**
* Handle collection of {@link RecordCategoryEntry}
*
* @author Ramona Popa
* @author Tuna Aksoy
* @since 2.6
*/
public class RecordCategoryCollection extends RestModels<RecordCategoryEntry, RecordCategoryCollection>
{
}

View File

@@ -0,0 +1,50 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.recordcategory;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.RestModels;
import org.alfresco.rest.rm.community.model.fileplan.FilePlan;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* POJO for file plan entry
*
* @author Ramona Popa
* @author Tuna Aksoy
* @since 2.6
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class RecordCategoryEntry extends RestModels<FilePlan, RecordCategoryEntry>
{
@JsonProperty
private RecordCategory entry;
}

View File

@@ -0,0 +1,95 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.recordcategory;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ID_IS_TEMPORARILY_EDITABLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_PERIOD;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.alfresco.rest.rm.community.model.common.Owner;
import org.alfresco.rest.rm.community.model.common.ReviewPeriod;
import org.alfresco.rest.rm.community.util.ReviewPeriodSerializer;
import org.alfresco.utility.model.TestModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for record category properties
*
* @author Tuna Aksoy
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class RecordCategoryProperties extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true, value = PROPERTIES_ID_IS_TEMPORARILY_EDITABLE)
private Boolean idIsTemporarilyEditable;
@JsonProperty (required = true, value = PROPERTIES_IDENTIFIER)
private String identifier;
@JsonProperty (required = true, value = PROPERTIES_REVIEW_PERIOD)
@JsonSerialize (using = ReviewPeriodSerializer.class)
private ReviewPeriod reviewPeriod;
@JsonProperty (required = true, value = PROPERTIES_VITAL_RECORD_INDICATOR)
private Boolean vitalRecordIndicator;
/************************/
/** Optional parameters */
/************************/
@JsonProperty (PROPERTIES_TITLE)
private String title;
@JsonProperty (PROPERTIES_ROOT_NODE_REF)
private String rootNodeRef;
@JsonProperty (PROPERTIES_DESCRIPTION)
private String description;
@JsonProperty (PROPERTIES_OWNER)
private Owner owner;
}

View File

@@ -0,0 +1,100 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.recordfolder;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.model.RestByUserModel;
import org.alfresco.rest.rm.community.model.common.Path;
import org.alfresco.utility.model.TestModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for record folder
*
* @author Tuna Aksoy
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class RecordFolder extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true)
private RestByUserModel createdByUser;
@JsonProperty (required = true)
private String modifiedAt;
@JsonProperty (required = true)
private String nodeType;
@JsonProperty (required = true)
private String parentId;
@JsonProperty (required = true)
private List<String> aspectNames;
@JsonProperty (required = true)
private String createdAt;
@JsonProperty (required = true)
private RestByUserModel modifiedByUser;
@JsonProperty (required = true)
private String name;
@JsonProperty (required = true)
private String id;
@JsonProperty (required = true)
private RecordFolderProperties properties;
/************************/
/** Optional parameters */
/************************/
@JsonProperty
private Boolean isClosed;
@JsonProperty
private List<String> allowableOperations;
@JsonProperty
private Path path;
}

View File

@@ -24,17 +24,18 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.rm.community.model.fileplancomponents;
package org.alfresco.rest.rm.community.model.recordfolder;
import org.alfresco.rest.core.RestModels;
/**
* Handle collection of FilePlanComponents
* Handle collection of {@link RecordFolderEntry}
*
* @author Kristijan Conkas
* @author Tuna Aksoy
* @since 2.6
*/
public class FilePlanComponentsCollection extends RestModels<FilePlanComponentEntry, FilePlanComponentsCollection>
public class RecordFolderCollection extends RestModels<RecordFolderEntry, RecordFolderCollection>
{
}

View File

@@ -24,13 +24,12 @@
* 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.ENTRY;
package org.alfresco.rest.rm.community.model.recordfolder;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.RestModels;
import org.alfresco.rest.rm.community.model.record.Record;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -39,7 +38,7 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for file plan component entry
* POJO for record folder entry
*
* @author Tuna Aksoy
* @since 2.6
@@ -49,8 +48,8 @@ import lombok.NoArgsConstructor;
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class FilePlanComponentEntry extends RestModels<FilePlanComponent, FilePlanComponentEntry>
public class RecordFolderEntry extends RestModels<RecordFolder, RecordFolderEntry>
{
@JsonProperty(ENTRY)
FilePlanComponent filePlanComponentModel;
@JsonProperty
private Record entry;
}

View File

@@ -0,0 +1,119 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.recordfolder;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_HELD_CHILDREN_COUNT;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ID_IS_TEMPORARILY_EDITABLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IS_CLOSED;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_LOCATION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_PERIOD;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.alfresco.rest.rm.community.model.common.Owner;
import org.alfresco.rest.rm.community.model.common.ReviewPeriod;
import org.alfresco.rest.rm.community.util.ReviewPeriodSerializer;
import org.alfresco.utility.model.TestModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for record folder properties
*
* @author Tuna Aksoy
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class RecordFolderProperties extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true, value = PROPERTIES_ID_IS_TEMPORARILY_EDITABLE)
private Boolean idIsTemporarilyEditable;
@JsonProperty (required = true, value = PROPERTIES_IS_CLOSED)
private Boolean isClosed;
@JsonProperty (required = true, value = PROPERTIES_IDENTIFIER)
private String identifier;
@JsonProperty (required = true, value = PROPERTIES_HELD_CHILDREN_COUNT)
private Integer heldChildrenCount;
/************************/
/** Optional parameters */
/************************/
@JsonProperty (PROPERTIES_TITLE)
private String title;
@JsonProperty (PROPERTIES_VITAL_RECORD_INDICATOR)
private Boolean vitalRecordIndicator;
@JsonProperty (PROPERTIES_ROOT_NODE_REF)
private String rootNodeRef;
@JsonProperty (PROPERTIES_LOCATION)
private String location;
@JsonProperty (PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE)
private Boolean recordSearchHasDispositionSchedule;
@JsonProperty (PROPERTIES_REVIEW_PERIOD)
@JsonSerialize (using = ReviewPeriodSerializer.class)
private ReviewPeriod reviewPeriod;
@JsonProperty (PROPERTIES_DESCRIPTION)
private String description;
@JsonProperty (PROPERTIES_OWNER)
private Owner owner;
@JsonProperty (PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD)
private String recordSearchVitalRecordReviewPeriod;
@JsonProperty (PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION)
private String recordSearchVitalRecordReviewPeriodExpression;
}

View File

@@ -26,8 +26,6 @@
*/
package org.alfresco.rest.rm.community.model.site;
import static org.alfresco.rest.rm.community.model.site.RMSiteFields.COMPLIANCE;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.model.RestSiteModel;
@@ -51,6 +49,6 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
public class RMSite extends RestSiteModel
{
@JsonProperty (value = COMPLIANCE, required = true)
@JsonProperty (required = true)
private RMSiteCompliance compliance;
}

View File

@@ -0,0 +1,89 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.transfer;
import java.util.List;
import org.alfresco.rest.model.RestByUserModel;
import org.alfresco.rest.rm.community.model.common.Path;
import org.alfresco.utility.model.TestModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for Transfer
*
* @author Silviu Dinuta
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class Transfer extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true)
private RestByUserModel createdByUser;
@JsonProperty (required = true)
private String nodeType;
@JsonProperty (required = true)
private String parentId;
@JsonProperty (required = true)
private List<String> aspectNames;
@JsonProperty (required = true)
private String createdAt;
@JsonProperty (required = true)
private String name;
@JsonProperty (required = true)
private String id;
@JsonProperty (required = true)
private TransferProperties properties;
/************************/
/** Optional parameters */
/************************/
@JsonProperty
private List<String> allowableOperations;
}

View File

@@ -0,0 +1,110 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.transfer;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.model.RestByUserModel;
import org.alfresco.rest.rm.community.model.common.Path;
import org.alfresco.utility.model.TestModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for transfer child
*
* @author Silviu Dinuta
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class TransferChild extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true)
private String createdAt;
@JsonProperty (required = true)
private RestByUserModel createdByUser;
@JsonProperty (required = true)
private String modifiedAt;
@JsonProperty (required = true)
private RestByUserModel modifiedByUser;
@JsonProperty (required = true)
private String name;
@JsonProperty (required = true)
private String id;
@JsonProperty (required = true)
private String nodeType;
@JsonProperty (required = true)
private String parentId;
/************************/
/** Optional parameters */
/************************/
@JsonProperty
private TransferChildProperties properties;
@JsonProperty
private Boolean isRecord;
@JsonProperty
private Boolean isRecordFolder;
@JsonProperty
private List<String> aspectNames;
@JsonProperty
private Boolean isCompleted;
@JsonProperty
private Boolean isClosed;
@JsonProperty
private List<String> allowableOperations;
@JsonProperty
private Path path;
}

View File

@@ -0,0 +1,40 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.transfer;
import org.alfresco.rest.core.RestModels;
/**
* Handle collection of {@link TransferChildEntry}
* @author Silviu Dinuta
* @since 2.6
*/
public class TransferChildCollection extends RestModels<TransferChildEntry, TransferChildCollection>
{
}

View File

@@ -0,0 +1,55 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.transfer;
import org.alfresco.rest.core.RestModels;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for transfer child entry
*
* @author Silviu Dinuta
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class TransferChildEntry extends RestModels<Transfer, TransferChildEntry>
{
@JsonProperty
private TransferChild entry;
}

View File

@@ -0,0 +1,223 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.transfer;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_BOX;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DATE_FILED;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DATE_TIME_ORIGINAL;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_EXPOSURE_TIME;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FILE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FLASH;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FOCAL_LENGTH;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_F_NUMBER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_HELD_CHILDREN_COUNT;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ID_IS_TEMPORARILY_EDITABLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ISO_SPEED_RATINGS;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IS_CLOSED;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_LOCATION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_MANUFACTURER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_MODEL;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_NUMBER_OF_COPIES;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ORIENTATION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ORIGINAL_NAME;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PHYSICAL_SIZE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PIXEL_X_DIMENSION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PIXEL_Y_DIMENSION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RESOLUTION_UNIT;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_PERIOD;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SHELF;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SOFTWARE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_STORAGE_LOCATION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VERSION_LABEL;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VERSION_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_X_RESOLUTION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_Y_RESOLUTION;
import org.alfresco.rest.rm.community.model.common.Owner;
import org.alfresco.rest.rm.community.model.common.ReviewPeriod;
import org.alfresco.rest.rm.community.util.ReviewPeriodSerializer;
import org.alfresco.utility.model.TestModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for transfer child properties
*
* @author Silviu Dinuta
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class TransferChildProperties extends TestModel
{
/**************************************************************************/
/** Mandatory parameters - Shared by record folders and records*/
/**************************************************************************/
@JsonProperty (PROPERTIES_TITLE)
private String title;
@JsonProperty (required = true, value = PROPERTIES_ROOT_NODE_REF)
private String rootNodeRef;
@JsonProperty (required = true, value = PROPERTIES_ID_IS_TEMPORARILY_EDITABLE)
private Boolean idIsTemporarilyEditable;
@JsonProperty (required = true, value = PROPERTIES_IDENTIFIER)
private String identifier;
@JsonProperty (PROPERTIES_DESCRIPTION)
private String description;
/*********************************************************/
/** Optional parameters - Applies only to record folders */
/*********************************************************/
@JsonProperty (PROPERTIES_VITAL_RECORD_INDICATOR)
private Boolean vitalRecordIndicator;
@JsonProperty (PROPERTIES_REVIEW_PERIOD)
@JsonSerialize (using = ReviewPeriodSerializer.class)
private ReviewPeriod reviewPeriod;
@JsonProperty (PROPERTIES_HELD_CHILDREN_COUNT)
private Integer heldChildrenCount;
@JsonProperty (PROPERTIES_LOCATION)
private String location;
@JsonProperty (PROPERTIES_IS_CLOSED)
private Boolean isClosed;
/*********************************************************/
/** Optional parameters - Applies only to records */
/*********************************************************/
@JsonProperty (PROPERTIES_DATE_FILED)
private String dateField;
@JsonProperty (PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE)
private Boolean recordSearchHasDispositionSchedule;
@JsonProperty (PROPERTIES_ORIGINAL_NAME)
private String originalName;
/*********************************/
/** Electronic record parameters */
/*********************************/
@JsonProperty (PROPERTIES_VERSION_TYPE)
private String versionType;
@JsonProperty (PROPERTIES_VERSION_LABEL)
private String versionLabel;
@JsonProperty (PROPERTIES_DATE_TIME_ORIGINAL)
private String dateTimeOriginal;
@JsonProperty (PROPERTIES_EXPOSURE_TIME)
private Double exposureTime;
@JsonProperty (PROPERTIES_FLASH)
private Boolean flash;
@JsonProperty (PROPERTIES_F_NUMBER)
private Double fNumber;
@JsonProperty (PROPERTIES_FOCAL_LENGTH)
private Double focalLength;
@JsonProperty (PROPERTIES_ISO_SPEED_RATINGS)
private Integer isoSpeedRatings;
@JsonProperty (PROPERTIES_MANUFACTURER)
private String manufacturer;
@JsonProperty (PROPERTIES_MODEL)
private String model;
@JsonProperty (PROPERTIES_ORIENTATION)
private Integer orientation;
@JsonProperty (PROPERTIES_PIXEL_X_DIMENSION)
private Integer pixelXDimension;
@JsonProperty (PROPERTIES_PIXEL_Y_DIMENSION)
private Integer pixelYDimension;
@JsonProperty (PROPERTIES_RESOLUTION_UNIT)
private String resolutionUnit;
@JsonProperty (PROPERTIES_SOFTWARE)
private String software;
@JsonProperty (PROPERTIES_X_RESOLUTION)
private Double xResolution;
@JsonProperty (PROPERTIES_Y_RESOLUTION)
private Double yResolution;
/*************************************/
/** Non-electronic record parameters */
/*************************************/
@JsonProperty (PROPERTIES_SHELF)
private String shelf;
@JsonProperty (PROPERTIES_STORAGE_LOCATION)
private String storageLocation;
@JsonProperty (PROPERTIES_FILE)
private String file;
@JsonProperty (PROPERTIES_BOX)
private String box;
@JsonProperty (PROPERTIES_NUMBER_OF_COPIES)
private Integer numberOfCopies;
@JsonProperty (PROPERTIES_PHYSICAL_SIZE)
private Integer physicalSize;
@JsonProperty (PROPERTIES_OWNER)
private Owner owner;
}

View File

@@ -0,0 +1,40 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.transfer;
import org.alfresco.rest.core.RestModels;
/**
* Handle collection of {@link TransferEntry}
* @author Silviu Dinuta
* @since 2.6
*/
public class TransferCollection extends RestModels<TransferEntry, TransferCollection>
{
}

View File

@@ -0,0 +1,56 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.transfer;
import org.alfresco.rest.core.RestModels;
import org.alfresco.rest.rm.community.model.transfercontainer.TransferContainer;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for transfer entry
*
* @author Silviu Dinuta
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class TransferEntry extends RestModels<TransferContainer, TransferEntry>
{
@JsonProperty
private Transfer entry;
}

View File

@@ -0,0 +1,88 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.transfer;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ID_IS_TEMPORARILY_EDITABLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PDF_INDICATOR;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TRANSFER_LOCATION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ACCESSION_INDICATOR;
import org.alfresco.rest.rm.community.model.common.Owner;
import org.alfresco.utility.model.TestModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for Transfer properties
*
* @author Dinuta Silviu
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class TransferProperties extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true, value = PROPERTIES_ID_IS_TEMPORARILY_EDITABLE)
private Boolean idIsTemporarilyEditable;
@JsonProperty (required = true, value = PROPERTIES_IDENTIFIER)
private String identifier;
/************************/
/** Optional parameters */
/************************/
@JsonProperty (PROPERTIES_ROOT_NODE_REF)
private String rootNodeRef;
@JsonProperty (PROPERTIES_OWNER)
private Owner owner;
@JsonProperty (PROPERTIES_PDF_INDICATOR)
private Boolean pdfIndicator;
@JsonProperty (PROPERTIES_TRANSFER_LOCATION)
private String transferLocation;
@JsonProperty (PROPERTIES_ACCESSION_INDICATOR)
private Boolean accessionIndicator;
}

View File

@@ -0,0 +1,95 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.transfercontainer;
import java.util.List;
import org.alfresco.rest.model.RestByUserModel;
import org.alfresco.rest.rm.community.model.common.Path;
import org.alfresco.utility.model.TestModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for Transfer Container
*
* @author Silviu Dinuta
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class TransferContainer extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true)
private RestByUserModel createdByUser;
@JsonProperty (required = true)
private String modifiedAt;
@JsonProperty (required = true)
private String nodeType;
@JsonProperty (required = true)
private String parentId;
@JsonProperty (required = true)
private List<String> aspectNames;
@JsonProperty (required = true)
private String createdAt;
@JsonProperty (required = true)
private RestByUserModel modifiedByUser;
@JsonProperty (required = true)
private String name;
@JsonProperty (required = true)
private String id;
@JsonProperty (required = true)
private TransferContainerProperties properties;
/************************/
/** Optional parameters */
/************************/
@JsonProperty
private List<String> allowableOperations;
}

View File

@@ -0,0 +1,76 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.transfercontainer;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_COUNT;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ID_IS_TEMPORARILY_EDITABLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF;
import org.alfresco.utility.model.TestModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for Transfer Container properties
*
* @author Dinuta Silviu
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class TransferContainerProperties extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true, value = PROPERTIES_ID_IS_TEMPORARILY_EDITABLE)
private Boolean idIsTemporarilyEditable;
@JsonProperty (required = true, value = PROPERTIES_IDENTIFIER)
private String identifier;
/************************/
/** Optional parameters */
/************************/
@JsonProperty (PROPERTIES_ROOT_NODE_REF)
private String rootNodeRef;
@JsonProperty (PROPERTIES_COUNT)
private Integer count;
}

View File

@@ -0,0 +1,97 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.unfiledcontainer;
import java.util.List;
import org.alfresco.rest.model.RestByUserModel;
import org.alfresco.rest.rm.community.model.common.Path;
import org.alfresco.utility.model.TestModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for unfiled container
*
* @author Tuna Aksoy
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class UnfiledContainer extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true)
private RestByUserModel createdByUser;
@JsonProperty (required = true)
private String modifiedAt;
@JsonProperty (required = true)
private String nodeType;
@JsonProperty (required = true)
private String parentId;
@JsonProperty (required = true)
private List<String> aspectNames;
@JsonProperty (required = true)
private String createdAt;
@JsonProperty (required = true)
private RestByUserModel modifiedByUser;
@JsonProperty (required = true)
private String name;
@JsonProperty (required = true)
private String id;
@JsonProperty (required = true)
private UnfiledContainerProperties properties;
/************************/
/** Optional parameters */
/************************/
@JsonProperty
private List<String> allowableOperations;
@JsonProperty
private Path path;
}

View File

@@ -24,21 +24,17 @@
* 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.IS_COMPLETED;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PATH;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.RELATIVE_PATH;
package org.alfresco.rest.rm.community.model.unfiledcontainer;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.model.RestByUserModel;
import org.alfresco.rest.rm.community.model.common.Path;
import org.alfresco.rest.rm.community.model.record.RecordContent;
import org.alfresco.utility.model.TestModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -46,10 +42,9 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for file plan component
* POJO for record category child
*
* @author Tuna Aksoy
* @author Rodica Sutu
* @since 2.6
*/
@Builder
@@ -57,65 +52,68 @@ import lombok.NoArgsConstructor;
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class FilePlanComponent extends TestModel
public class UnfiledContainerChild extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true)
private String id;
private String createdAt;
@JsonProperty (required = true)
private String parentId;
private Boolean isUnfiledRecordFolder;
@JsonProperty (required = true)
private String name;
private Boolean isRecord;
@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(value = IS_COMPLETED)
private Boolean isCompleted;
@JsonProperty (required = true)
private List<String> aspectNames;
@JsonProperty (required = true)
private FilePlanComponentUserInfo createdByUser;
@JsonProperty(value = PROPERTIES)
private FilePlanComponentProperties properties;
@JsonProperty (value = ALLOWABLE_OPERATIONS)
private List<String> allowableOperations;
@JsonProperty (required = false)
private FilePlanComponentContent content;
@JsonProperty (value = PATH)
private FilePlanComponentPath path;
private RestByUserModel createdByUser;
@JsonProperty (required = true)
private String modifiedAt;
@JsonProperty (required = true)
private String createdAt;
private RestByUserModel modifiedByUser;
@JsonProperty (required = true)
private FilePlanComponentUserInfo modifiedByUser;
private String name;
@JsonProperty (value = RELATIVE_PATH)
@JsonProperty (required = true)
private String id;
@JsonProperty (required = true)
private String nodeType;
@JsonProperty (required = true)
private String parentId;
/************************/
/** Optional parameters */
/************************/
@JsonProperty
private UnfiledContainerChildProperties properties;
@JsonProperty
private List<String> aspectNames;
@JsonProperty
private Boolean hasRetentionSchedule;
@JsonProperty
private Boolean isClosed;
@JsonProperty
private List<String> allowableOperations;
@JsonProperty
private Path path;
@JsonProperty
private String relativePath;
@JsonProperty
private RecordContent content;
@JsonProperty
private Boolean isCompleted;
}

View File

@@ -0,0 +1,41 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.unfiledcontainer;
import org.alfresco.rest.core.RestModels;
/**
* Handle collection of {@link UnfiledContainerChildEntry}
*
* @author Kristijan Conkas
* @author Tuna Aksoy
* @since 2.6
*/
public class UnfiledContainerChildCollection extends RestModels<UnfiledContainerChildEntry, UnfiledContainerChildCollection>
{
}

View File

@@ -0,0 +1,48 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.unfiledcontainer;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.RestModels;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* POJO for record category child entry
*
* @author Tuna Aksoy
* @since 2.6
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class UnfiledContainerChildEntry extends RestModels<UnfiledContainer, UnfiledContainerChildEntry>
{
@JsonProperty
private UnfiledContainerChild entry;
}

View File

@@ -0,0 +1,196 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.unfiledcontainer;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_BOX;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DATE_TIME_ORIGINAL;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_EXPOSURE_TIME;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FILE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FLASH;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FOCAL_LENGTH;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_F_NUMBER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ID_IS_TEMPORARILY_EDITABLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ISO_SPEED_RATINGS;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_MANUFACTURER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_MODEL;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_NUMBER_OF_COPIES;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ORIENTATION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ORIGINAL_NAME;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PHYSICAL_SIZE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PIXEL_X_DIMENSION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PIXEL_Y_DIMENSION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RESOLUTION_UNIT;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_PERIOD;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SHELF;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SOFTWARE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_STORAGE_LOCATION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VERSION_LABEL;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VERSION_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_X_RESOLUTION;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_Y_RESOLUTION;
import org.alfresco.rest.rm.community.model.common.Owner;
import org.alfresco.rest.rm.community.model.common.ReviewPeriod;
import org.alfresco.rest.rm.community.util.ReviewPeriodSerializer;
import org.alfresco.utility.model.TestModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for record category child properties
*
* @author Tuna Aksoy
* @author Ana Bozianu
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class UnfiledContainerChildProperties extends TestModel
{
/**************************************************************************/
/** Mandatory parameters - Shared by unfiled record folder and records */
/**************************************************************************/
@JsonProperty (required = true, value = PROPERTIES_TITLE)
private String title;
@JsonProperty (required = true, value = PROPERTIES_VITAL_RECORD_INDICATOR)
private Boolean vitalRecordIndicator;
@JsonProperty (required = true, value = PROPERTIES_ROOT_NODE_REF)
private String rootNodeRef;
@JsonProperty (required = true, value = PROPERTIES_ID_IS_TEMPORARILY_EDITABLE)
private Boolean idIsTemporarilyEditable;
@JsonProperty (required = true, value = PROPERTIES_IDENTIFIER)
private String identifier;
@JsonProperty (required = true, value = PROPERTIES_REVIEW_PERIOD)
@JsonSerialize (using = ReviewPeriodSerializer.class)
private ReviewPeriod reviewPeriod;
@JsonProperty (required = true, value = PROPERTIES_DESCRIPTION)
private String description;
/*********************************/
/** Electronic record parameters */
/*********************************/
@JsonProperty (PROPERTIES_VERSION_TYPE)
private String versionType;
@JsonProperty (PROPERTIES_VERSION_LABEL)
private String versionLabel;
@JsonProperty (PROPERTIES_DATE_TIME_ORIGINAL)
private String dateTimeOriginal;
@JsonProperty (PROPERTIES_EXPOSURE_TIME)
private Double exposureTime;
@JsonProperty (PROPERTIES_FLASH)
private Boolean flash;
@JsonProperty (PROPERTIES_F_NUMBER)
private Double fNumber;
@JsonProperty (PROPERTIES_FOCAL_LENGTH)
private Double focalLength;
@JsonProperty (PROPERTIES_ISO_SPEED_RATINGS)
private Integer isoSpeedRatings;
@JsonProperty (PROPERTIES_MANUFACTURER)
private String manufacturer;
@JsonProperty (PROPERTIES_MODEL)
private String model;
@JsonProperty (PROPERTIES_ORIENTATION)
private Integer orientation;
@JsonProperty (PROPERTIES_PIXEL_X_DIMENSION)
private Integer pixelXDimension;
@JsonProperty (PROPERTIES_PIXEL_Y_DIMENSION)
private Integer pixelYDimension;
@JsonProperty (PROPERTIES_RESOLUTION_UNIT)
private String resolutionUnit;
@JsonProperty (PROPERTIES_SOFTWARE)
private String software;
@JsonProperty (PROPERTIES_X_RESOLUTION)
private Double xResolution;
@JsonProperty (PROPERTIES_Y_RESOLUTION)
private Double yResolution;
@JsonProperty (PROPERTIES_ORIGINAL_NAME)
private String originalName;
/*************************************/
/** Non-electronic record parameters */
/*************************************/
@JsonProperty (PROPERTIES_SHELF)
private String shelf;
@JsonProperty (PROPERTIES_STORAGE_LOCATION)
private String storageLocation;
@JsonProperty (PROPERTIES_FILE)
private String file;
@JsonProperty (PROPERTIES_BOX)
private String box;
@JsonProperty (PROPERTIES_NUMBER_OF_COPIES)
private Integer numberOfCopies;
@JsonProperty (PROPERTIES_PHYSICAL_SIZE)
private Integer physicalSize;
@JsonProperty (PROPERTIES_OWNER)
private Owner owner;
}

View File

@@ -0,0 +1,71 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.unfiledcontainer;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ID_IS_TEMPORARILY_EDITABLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
import org.alfresco.rest.rm.community.model.common.Owner;
import org.alfresco.utility.model.TestModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for file plan properties
*
* @author Tuna Aksoy
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class UnfiledContainerProperties extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true, value = PROPERTIES_ID_IS_TEMPORARILY_EDITABLE)
private Boolean idIsTemporarilyEditable;
@JsonProperty (required = true, value = PROPERTIES_IDENTIFIER)
private String identifier;
@JsonProperty (required = true, value = PROPERTIES_ROOT_NODE_REF)
private String rootNodeRef;
}

View File

@@ -0,0 +1,113 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.unfiledcontainer;
import java.util.List;
import org.alfresco.rest.model.RestByUserModel;
import org.alfresco.rest.rm.community.model.common.Path;
import org.alfresco.rest.rm.community.model.record.RecordContent;
import org.alfresco.utility.model.TestModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* POJO for unfiled container
*
* @author Ramona Popa
* @since 2.6
*/
@Builder
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class UnfiledRecordFolder extends TestModel
{
/*************************/
/** Mandatory parameters */
/*************************/
@JsonProperty (required = true)
private String createdAt;
@JsonProperty (required = true)
private RestByUserModel createdByUser;
@JsonProperty (required = true)
private String modifiedAt;
@JsonProperty (required = true)
private RestByUserModel modifiedByUser;
@JsonProperty (required = true)
private String name;
@JsonProperty (required = true)
private String id;
@JsonProperty (required = true)
private String nodeType;
@JsonProperty (required = true)
private String parentId;
/************************/
/** Optional parameters */
/************************/
@JsonProperty
private UnfiledContainerChildProperties properties;
@JsonProperty
private List<String> aspectNames;
@JsonProperty
private Boolean hasRetentionSchedule;
@JsonProperty
private Boolean isClosed;
@JsonProperty
private List<String> allowableOperations;
@JsonProperty
private Path path;
@JsonProperty
private String relativePath;
@JsonProperty
private RecordContent content;
@JsonProperty
private Boolean isCompleted;
}

View File

@@ -26,9 +26,15 @@
*/
package org.alfresco.rest.rm.community.requests;
import static lombok.AccessLevel.PRIVATE;
import static lombok.AccessLevel.PROTECTED;
import org.alfresco.rest.core.RMRestWrapper;
import org.alfresco.rest.requests.ModelRequest;
import lombok.Getter;
import lombok.Setter;
/**
* Extends {@link ModelRequest} to set {@link RMRestWrapper}
*
@@ -37,22 +43,16 @@ import org.alfresco.rest.requests.ModelRequest;
*/
public abstract class RMModelRequest extends ModelRequest<RMModelRequest>
{
@Getter (value = PROTECTED)
@Setter (value = PRIVATE)
private RMRestWrapper rmRestWrapper;
/**
* @return the rmRestWrapper
*/
public RMRestWrapper getRMRestWrapper()
{
return this.rmRestWrapper;
}
/**
* @param rmRestWrapper
* @param restWrapper
*/
public RMModelRequest(RMRestWrapper rmRestWrapper)
{
super(rmRestWrapper.getRestWrapper());
this.rmRestWrapper = rmRestWrapper;
setRmRestWrapper(rmRestWrapper);
}
}

View File

@@ -0,0 +1,182 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.requests.gscore;
import static java.lang.Integer.parseInt;
import static java.lang.String.format;
import com.jayway.restassured.RestAssured;
import org.alfresco.rest.core.RMRestProperties;
import org.alfresco.rest.core.RMRestWrapper;
import org.alfresco.rest.rm.community.requests.RMModelRequest;
import org.alfresco.rest.rm.community.requests.gscore.api.FilePlanAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.FilesAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RMUserAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.TransferAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.TransferContainerAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI;
/**
* Defines the entire GS Core API
* {@link http://host:port/gs-api-explorer} select "GS Core API"
*
* @author Tuna Aksoy
* @since 2.6
*/
public class GSCoreAPI extends RMModelRequest
{
/**
* Constructor
*
* @param rmRestWrapper RM REST Wrapper
* @param rmRestProperties RM REST Properties
*/
public GSCoreAPI(RMRestWrapper rmRestWrapper, RMRestProperties rmRestProperties)
{
super(rmRestWrapper);
RestAssured.baseURI = format("%s://%s", rmRestProperties.getScheme(), rmRestProperties.getServer());
RestAssured.port = parseInt(rmRestProperties.getPort());
RestAssured.basePath = rmRestProperties.getRestRmPath();
restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath);
}
/**
* Provides DSL on all REST calls under <code>ig-sites/rm/...</code> API path
*
* @return {@link RMSiteAPI}
*/
public RMSiteAPI usingRMSite()
{
return new RMSiteAPI(getRmRestWrapper());
}
/**
* Provides DSL on all REST calls under <code>file-plans/...</code> API path
*
* @return {@link FilePlanAPI}
*/
public FilePlanAPI usingFilePlans()
{
return new FilePlanAPI(getRmRestWrapper());
}
/**
* Provides DSL on all REST calls under <code>record-categories/...</code> API path
*
* @return {@link RecordCategoryAPI}
*/
public RecordCategoryAPI usingRecordCategory()
{
return new RecordCategoryAPI(getRmRestWrapper());
}
/**
* Provides DSL on all REST calls under <code>record-folders/...</code> API path
*
* @return {@link RecordFolderAPI}
*/
public RecordFolderAPI usingRecordFolder()
{
return new RecordFolderAPI(getRmRestWrapper());
}
/**
* Provides DSL on all REST calls under <code>records/...</code> API path
*
* @return {@link FilePlanComponentAPI}
*/
public RecordsAPI usingRecords()
{
return new RecordsAPI(getRmRestWrapper());
}
/**
* Provides DSL on all REST calls under <code>files/...</code> API path
*
* @return {@link FilesAPI}
*/
public FilesAPI usingFiles()
{
return new FilesAPI(getRmRestWrapper());
}
/**
* Provides DSL on all REST calls under <code>transfer-containers/...</code> API path
*
* @return {@link TransferContainerAPI}
*/
public TransferContainerAPI usingTransferContainer()
{
return new TransferContainerAPI(getRmRestWrapper());
}
/**
* Provides DSL on all REST calls under <code>transfers/...</code> API path
*
* @return {@link TransferAPI}
*/
public TransferAPI usingTransfer()
{
return new TransferAPI(getRmRestWrapper());
}
/**
* Provides DSL for RM unfiled container API
*
* @return {@link UnfiledContainerAPI}
*/
public UnfiledContainerAPI usingUnfiledContainers()
{
return new UnfiledContainerAPI(getRmRestWrapper());
}
/**
* Provides DSL for RM unfiled record folders API
*
* @return {@link UnfiledRecordFolderAPI}
*/
public UnfiledRecordFolderAPI usingUnfiledRecordFolder()
{
return new UnfiledRecordFolderAPI(getRmRestWrapper());
}
/**
* Provides DSL for RM user management API
*
* @return {@link RMUserAPI}
*/
public RMUserAPI usingRMUser()
{
return new RMUserAPI(getRmRestWrapper());
}
}

View File

@@ -0,0 +1,175 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.requests.gscore.api;
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.apache.commons.lang3.StringUtils.EMPTY;
import static org.springframework.http.HttpMethod.GET;
import static org.springframework.http.HttpMethod.POST;
import org.alfresco.rest.core.RMRestWrapper;
import org.alfresco.rest.rm.community.model.fileplan.FilePlan;
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryCollection;
import org.alfresco.rest.rm.community.requests.RMModelRequest;
/**
* File plan REST API Wrapper
*
* @author Ramona Popa
* @author Tuna Aksoy
* @since 2.6
*/
public class FilePlanAPI extends RMModelRequest
{
/**
* Constructor.
*
* @param restWrapper
*/
public FilePlanAPI(RMRestWrapper rmRestWrapper)
{
super(rmRestWrapper);
}
/**
* see {@link #getFilePlan(String, String)}
*/
public FilePlan getFilePlan(String filePlanId)
{
mandatoryString("filePlanId", filePlanId);
return getFilePlan(filePlanId, EMPTY);
}
/**
* Gets a file plan.
*
* @param filePlanId The identifier of a file plan
* @param parameters The URL parameters to add
* @return The {@link FilePlan} for the given {@code filePlanId}
* @throws Exception for the following cases:
* <ul>
* <li>{@code filePlanId} is not a valid format</li>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code filePlanId}</li>
* <li>{@code filePlanId} does not exist</li>
* </ul>
*/
public FilePlan getFilePlan(String filePlanId, String parameters)
{
mandatoryString("filePlanId", filePlanId);
return getRmRestWrapper().processModel(FilePlan.class, simpleRequest(
GET,
"/file-plans/{filePlanId}?{parameters}",
filePlanId,
parameters
));
}
/**
* see {@link #getRootRecordCategories(String, String)}
*/
public RecordCategoryCollection getRootRecordCategories(String filePlanId)
{
mandatoryString("filePlanId", filePlanId);
return getRootRecordCategories(filePlanId, EMPTY);
}
/**
* Gets the children (root categories) of a file plan.
*
* @param filePlanId The identifier of a file plan
* @param parameters The URL parameters to add
* @return The {@link RecordCategoryCollection} for the given {@code filePlanId}
* @throws Exception for the following cases:
* <ul>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code filePlanId}</li>
* <li>{@code filePlanId} does not exist</li>
*</ul>
*/
public RecordCategoryCollection getRootRecordCategories(String filePlanId, String parameters)
{
mandatoryString("filePlanId", filePlanId);
return getRmRestWrapper().processModels(RecordCategoryCollection.class, simpleRequest(
GET,
"file-plans/{filePlanId}/categories?{parameters}",
filePlanId,
parameters
));
}
/**
* see {@link #createRootRecordCategory(RecordCategory, String, String)}
*/
public RecordCategory createRootRecordCategory(RecordCategory recordCategoryModel, String filePlanId) throws Exception
{
mandatoryObject("recordCategoryModel", recordCategoryModel);
mandatoryString("filePlanId", filePlanId);
return createRootRecordCategory(recordCategoryModel, filePlanId, EMPTY);
}
/**
* Creates a root record category.
*
* @param recordCategoryModel The record category model which holds the information
* @param filePlanId The identifier of a file plan
* @param parameters The URL parameters to add
* @return The created {@link RecordCategory}
* @throws Exception for the following cases:
* <ul>
* <li>{@code filePlanId} is not a valid format or {@code filePlanId} is invalid</li>
* <li>authentication fails</li>
* <li>current user does not have permission to add children to {@code filePlanId}</li>
* <li>{@code filePlanIds} 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 RecordCategory createRootRecordCategory(RecordCategory recordCategoryModel, String filePlanId, String parameters) throws Exception
{
mandatoryObject("recordCategoryModel", recordCategoryModel);
mandatoryString("filePlanId", filePlanId);
return getRmRestWrapper().processModel(RecordCategory.class, requestWithBody(
POST,
toJson(recordCategoryModel),
"file-plans/{filePlanId}/categories?{parameters}",
filePlanId,
parameters
));
}
}

View File

@@ -24,7 +24,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.rm.community.requests.igCoreAPI;
package org.alfresco.rest.rm.community.requests.gscore.api;
import static org.alfresco.rest.core.RestRequest.simpleRequest;
import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString;
@@ -32,10 +32,8 @@ import static org.apache.commons.lang3.StringUtils.EMPTY;
import static org.springframework.http.HttpMethod.POST;
import org.alfresco.rest.core.RMRestWrapper;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
import org.alfresco.rest.rm.community.model.record.Record;
import org.alfresco.rest.rm.community.requests.RMModelRequest;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* Files REST API Wrapper
@@ -43,8 +41,6 @@ import org.springframework.stereotype.Component;
* @author Kristijan Conkas
* @since 2.6
*/
@Component
@Scope (value = "prototype")
public class FilesAPI extends RMModelRequest
{
/**
@@ -57,16 +53,17 @@ public class FilesAPI extends RMModelRequest
/**
* Declare file as record
*
* @param fileId The Id of a file to declare as record
* @param parameters Request parameters, refer to API documentation for more details
* @return The {@link FilePlanComponent} for created record
* @return The {@link Record} for created record
* @throws Exception for malformed JSON responses
*/
public FilePlanComponent declareAsRecord(String fileId, String parameters) throws Exception
public Record declareAsRecord(String fileId, String parameters) throws Exception
{
mandatoryString("fileId", fileId);
return getRMRestWrapper().processModel(FilePlanComponent.class, simpleRequest(
return getRmRestWrapper().processModel(Record.class, simpleRequest(
POST,
"/files/{fileId}/declare?{parameters}",
fileId,
@@ -76,12 +73,15 @@ public class FilesAPI extends RMModelRequest
/**
* A no-parameter version of {@link FilesAPI#declareAsRecord}
*
* @param fileId The Id of a file to declare as record
* @return The {@link FilePlanComponent} for created record
* @return The {@link Record} for created record
* @throws Exception for malformed JSON responses
*/
public FilePlanComponent declareAsRecord(String fileId) throws Exception
public Record declareAsRecord(String fileId) throws Exception
{
mandatoryString("fileId", fileId);
return declareAsRecord(fileId, EMPTY);
}
}

View File

@@ -24,7 +24,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.rm.community.requests.igCoreAPI;
package org.alfresco.rest.rm.community.requests.gscore.api;
import static org.alfresco.rest.core.RestRequest.requestWithBody;
import static org.alfresco.rest.core.RestRequest.simpleRequest;
@@ -72,9 +72,9 @@ public class RMSiteAPI extends RMModelRequest
*/
public RMSite getSite() throws Exception
{
return getRMRestWrapper().processModel(RMSite.class, simpleRequest(
return getRmRestWrapper().processModel(RMSite.class, simpleRequest(
GET,
"ig-sites/rm"
"gs-sites/rm"
));
}
@@ -95,10 +95,10 @@ public class RMSiteAPI extends RMModelRequest
{
mandatoryObject("rmSiteModel", rmSiteModel);
return getRMRestWrapper().processModel(RMSite.class, requestWithBody(
return getRmRestWrapper().processModel(RMSite.class, requestWithBody(
POST,
toJson(rmSiteModel),
"ig-sites"
"gs-sites"
));
}
@@ -115,9 +115,9 @@ public class RMSiteAPI extends RMModelRequest
*/
public void deleteRMSite() throws Exception
{
getRMRestWrapper().processEmptyModel(simpleRequest(
getRmRestWrapper().processEmptyModel(simpleRequest(
DELETE,
"ig-sites/rm"
"gs-sites/rm"
));
}
@@ -139,10 +139,10 @@ public class RMSiteAPI extends RMModelRequest
{
mandatoryObject("rmSiteProperties", rmSiteModel);
return getRMRestWrapper().processModel(RMSite.class, requestWithBody(
return getRmRestWrapper().processModel(RMSite.class, requestWithBody(
PUT,
toJson(rmSiteModel),
"ig-sites/rm"
"gs-sites/rm"
));
}
@@ -161,6 +161,6 @@ public class RMSiteAPI extends RMModelRequest
public boolean existsRMSite() throws Exception
{
getSite();
return getRMRestWrapper().getStatusCode().equals(OK.toString());
return getRmRestWrapper().getStatusCode().equals(OK.toString());
}
}

View File

@@ -24,7 +24,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.rm.community.requests.igCoreAPI;
package org.alfresco.rest.rm.community.requests.gscore.api;
import static com.jayway.restassured.RestAssured.basic;
import static com.jayway.restassured.RestAssured.given;
@@ -42,13 +42,10 @@ import org.alfresco.dataprep.AlfrescoHttpClient;
import org.alfresco.dataprep.AlfrescoHttpClientFactory;
import org.alfresco.rest.core.RMRestProperties;
import org.alfresco.rest.core.RMRestWrapper;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
import org.alfresco.rest.rm.community.model.user.UserPermissions;
import org.alfresco.rest.rm.community.model.user.UserRoles;
import org.alfresco.rest.rm.community.requests.RMModelRequest;
import org.alfresco.utility.model.UserModel;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* RM user management API
@@ -59,8 +56,6 @@ import org.springframework.stereotype.Component;
// FIXME: As of December 2016 there is no v1-style API for managing RM users and users'
// roles/permissions. Until such APIs have become available, methods in this class are just proxies to
// "old-style" API calls.
@Component
@Scope (value = "prototype")
public class RMUserAPI extends RMModelRequest
{
/**
@@ -77,16 +72,16 @@ public class RMUserAPI extends RMModelRequest
*/
private AlfrescoHttpClient getAlfrescoHttpClient()
{
RMRestProperties properties = getRMRestWrapper().getRmRestProperties();
RMRestProperties properties = getRmRestWrapper().getRmRestProperties();
AlfrescoHttpClientFactory factory = new AlfrescoHttpClientFactory();
factory.setHost(properties.getServer());
factory.setPort(Integer.parseInt(properties.getPort()));
factory.setScheme(properties.getScheme());
return factory.getObject();
}
/**
* Assign RM role to user
* @param userName User's username
@@ -95,8 +90,8 @@ public class RMUserAPI extends RMModelRequest
*/
public void assignRoleToUser(String userName, String userRole) throws Exception
{
UserModel adminUser = getRMRestWrapper().getTestUser();
UserModel adminUser = getRmRestWrapper().getTestUser();
// get an "old-style" REST API client
AlfrescoHttpClient client = getAlfrescoHttpClient();
@@ -111,25 +106,25 @@ public class RMUserAPI extends RMModelRequest
.log().all()
.pathParam("role", userRole)
.pathParam("authority", userName)
.param("alf_ticket", client.getAlfTicket(adminUser.getUsername(),
.param("alf_ticket", client.getAlfTicket(adminUser.getUsername(),
adminUser.getPassword()))
.when()
.post("/rm/roles/{role}/authorities/{authority}")
.prettyPeek()
.andReturn();
getRMRestWrapper().setStatusCode(Integer.toString(response.getStatusCode()));
getRmRestWrapper().setStatusCode(Integer.toString(response.getStatusCode()));
}
/**
* Helper method to add permission on a component to user
* @param component {@link FilePlanComponent} on which permission should be given
* @param component The id of the file plan component on which permission should be given
* @param user {@link UserModel} for a user to be granted permission
* @param permission {@link UserPermissions} to be granted
*/
public void addUserPermission(FilePlanComponent component, UserModel user, String permission)
public void addUserPermission(String filePlanComponentId, UserModel user, String permission)
{
UserModel adminUser = getRMRestWrapper().getTestUser();
UserModel adminUser = getRmRestWrapper().getTestUser();
// get an "old-style" REST API client
AlfrescoHttpClient client = getAlfrescoHttpClient();
@@ -146,20 +141,20 @@ public class RMUserAPI extends RMModelRequest
.setBaseUri(client.getApiUrl())
.setBasePath("/")
.build();
// execute an "old-style" API call
Response response = given()
.spec(spec)
.auth().basic(adminUser.getUsername(), adminUser.getPassword())
.contentType(ContentType.JSON)
.body(bodyJson.toString())
.pathParam("nodeId", component.getId())
.pathParam("nodeId", filePlanComponentId)
.log().all()
.when()
.post("/node/workspace/SpacesStore/{nodeId}/rmpermissions")
.prettyPeek()
.andReturn();
getRMRestWrapper().setStatusCode(Integer.toString(response.getStatusCode()));
getRmRestWrapper().setStatusCode(Integer.toString(response.getStatusCode()));
}
/**
@@ -172,9 +167,9 @@ public class RMUserAPI extends RMModelRequest
*/
public boolean createUser(String userName, String userPassword, String userEmail)
{
UserModel adminUser = getRMRestWrapper().getTestUser();
UserModel adminUser = getRmRestWrapper().getTestUser();
AlfrescoHttpClient client = getAlfrescoHttpClient();
JsonObject body = buildObject()
.add("userName", userName)
.add("firstName", userName)
@@ -182,7 +177,7 @@ public class RMUserAPI extends RMModelRequest
.add("password", userPassword)
.add("email", userEmail)
.getJson();
RequestSpecification spec = new RequestSpecBuilder()
.setBaseUri(client.getApiUrl())
.setBasePath("/")
@@ -190,7 +185,7 @@ public class RMUserAPI extends RMModelRequest
.setContentType(ContentType.JSON)
.setBody(body.toString())
.build();
// create POST request to "people" endpoint
Response response = given()
.spec(spec)
@@ -199,7 +194,7 @@ public class RMUserAPI extends RMModelRequest
.post("people")
.prettyPeek()
.andReturn();
return (response.getStatusCode() == OK.value());
}
}

View File

@@ -0,0 +1,242 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.requests.gscore.api;
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.apache.commons.lang3.StringUtils.EMPTY;
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.RMRestWrapper;
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChildCollection;
import org.alfresco.rest.rm.community.requests.RMModelRequest;
/**
* Record category REST API Wrapper
*
* @author Tuna Aksoy
* @since 2.6
*/
public class RecordCategoryAPI extends RMModelRequest
{
/**
* Constructor.
*
* @param restWrapper
*/
public RecordCategoryAPI(RMRestWrapper rmRestWrapper)
{
super(rmRestWrapper);
}
/**
* Deletes a record category.
*
* @param recordCategoryId The identifier of a record category
* @throws Exception for the following cases:
* <ul>
* <li>{@code recordCategoryId} is not a valid format</li>
* <li>authentication fails</li>
* <li>current user does not have permission to delete {@code recordCategoryId}</li>
* <li>{@code recordCategoryId} does not exist</li>
* <li>{@code recordCategoryId} is locked and cannot be deleted</li>
* </ul>
*/
public void deleteRecordCategory(String recordCategoryId)
{
mandatoryString("recordCategoryId", recordCategoryId);
getRmRestWrapper().processEmptyModel(simpleRequest(
DELETE,
"record-categories/{recordCategoryId}",
recordCategoryId
));
}
/**
* see {@link #getRecordCategory(String, String)}
*/
public RecordCategory getRecordCategory(String recordCategoryId)
{
mandatoryString("recordCategoryId", recordCategoryId);
return getRecordCategory(recordCategoryId, EMPTY);
}
/**
* Gets a record category.
*
* @param recordCategoryId The identifier of a record category
* @param parameters The URL parameters to add
* @return The {@link RecordCategory} for the given {@code recordCategoryId}
* @throws Exception for the following cases:
* <ul>
* <li>{@code recordCategoryId} is not a valid format</li>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code recordCategoryId}</li>
* <li>{@code recordCategoryId} does not exist</li>
* </ul>
*/
public RecordCategory getRecordCategory(String recordCategoryId, String parameters)
{
mandatoryString("recordCategoryId", recordCategoryId);
return getRmRestWrapper().processModel(RecordCategory.class, simpleRequest(
GET,
"record-categories/{recordCategoryId}?{parameters}",
recordCategoryId,
parameters
));
}
/**
* see {@link #updateRecordCategory(RecordCategory, String, String)
*/
public RecordCategory updateRecordCategory(RecordCategory recordCategoryModel, String recordCategoryId) throws Exception
{
mandatoryObject("recordCategoryModel", recordCategoryModel);
mandatoryString("recordCategoryId", recordCategoryId);
return updateRecordCategory(recordCategoryModel, recordCategoryId, EMPTY);
}
/**
* Updates a record category.
*
* @param recordCategoryModel The record category model which holds the information
* @param recordCategoryId The identifier of a record category
* @param parameters The URL parameters to add
* @param returns The updated {@link RecordCategory}
* @throws Exception for the following cases:
* <ul>
* <li>the update request is invalid or {@code recordCategoryId} is not a valid format or {@code recordCategoryModel} is invalid</li>
* <li>authentication fails</li>
* <li>current user does not have permission to update {@code recordCategoryId}</li>
* <li>{@code recordCategoryId} does not exist</li>
* <li>the updated name clashes with an existing record category in the current parent category</li>
* <li>model integrity exception, including file name with invalid characters</li>
* </ul>
*/
public RecordCategory updateRecordCategory(RecordCategory recordCategoryModel, String recordCategoryId, String parameters) throws Exception
{
mandatoryObject("recordCategoryModel", recordCategoryModel);
mandatoryString("recordCategoryId", recordCategoryId);
return getRmRestWrapper().processModel(RecordCategory.class, requestWithBody(
PUT,
toJson(recordCategoryModel),
"record-categories/{recordCategoryId}?{parameters}",
recordCategoryId,
parameters
));
}
/**
* see {@link #getRecordCategoryChildren(String, String)}
*/
public RecordCategoryChildCollection getRecordCategoryChildren(String recordCategoryId)
{
mandatoryString("recordCategoryId", recordCategoryId);
return getRecordCategoryChildren(recordCategoryId, EMPTY);
}
/**
* Gets the children of a record category.
*
* @param recordCategoryId The identifier of a record category
* @param parameters The URL parameters to add
* @return The {@link RecordCategoryChildCollection} for the given {@code recordCategoryId}
* @throws Exception for the following cases:
* <ul>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code recordCategoryId}</li>
* <li>{@code recordCategoryId} does not exist</li>
*</ul>
*/
public RecordCategoryChildCollection getRecordCategoryChildren(String recordCategoryId, String parameters)
{
mandatoryString("recordCategoryId", recordCategoryId);
return getRmRestWrapper().processModels(RecordCategoryChildCollection.class, simpleRequest(
GET,
"record-categories/{recordCategoryId}/children?{parameters}",
recordCategoryId,
parameters
));
}
/**
* see {@link #createRecordCategoryChild(RecordCategoryChild, String, String)}
*/
public RecordCategoryChild createRecordCategoryChild(RecordCategoryChild recordCategoryChildModel, String recordCategoryId) throws Exception
{
mandatoryObject("recordCategoryChildModel", recordCategoryChildModel);
mandatoryString("recordCategoryId", recordCategoryId);
return createRecordCategoryChild(recordCategoryChildModel, recordCategoryId, EMPTY);
}
/**
* Creates a record category child. Can be a record category or a record folder.
*
* @param recordCategoryChildModel The record category child model which holds the information
* @param recordCategoryId The identifier of a record category
* @param parameters The URL parameters to add
* @return The created {@link RecordCategoryChild}
* @throws Exception for the following cases:
* <ul>
* <li>{@code recordCategoryId} is not a valid format or {@code recordCategoryChildModel} is invalid</li>
* <li>authentication fails</li>
* <li>current user does not have permission to add children to {@code recordCategoryId}</li>
* <li>{@code recordCategoryId} 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 RecordCategoryChild createRecordCategoryChild(RecordCategoryChild recordCategoryChildModel, String recordCategoryId, String parameters) throws Exception
{
mandatoryObject("filePlanComponentProperties", recordCategoryChildModel);
mandatoryString("recordCategoryId", recordCategoryId);
return getRmRestWrapper().processModel(RecordCategoryChild.class, requestWithBody(
POST,
toJson(recordCategoryChildModel),
"record-categories/{recordCategoryId}/children?{parameters}",
recordCategoryId,
parameters
));
}
}

View File

@@ -0,0 +1,291 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.requests.gscore.api;
import static org.alfresco.rest.core.RestRequest.requestWithBody;
import static org.alfresco.rest.core.RestRequest.simpleRequest;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
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.apache.commons.lang3.StringUtils.EMPTY;
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 static org.testng.Assert.fail;
import java.io.File;
import java.util.Iterator;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.http.ContentType;
import org.alfresco.rest.core.RMRestWrapper;
import org.alfresco.rest.rm.community.model.record.Record;
import org.alfresco.rest.rm.community.model.recordfolder.RecordFolder;
import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderCollection;
import org.alfresco.rest.rm.community.requests.RMModelRequest;
import org.alfresco.rest.rm.community.util.FilePlanComponentMixIn;
/**
* Record folder REST API Wrapper
*
* @author Tuna Aksoy
* @since 2.6
*/
public class RecordFolderAPI extends RMModelRequest
{
/**
* Constructor.
*
* @param restWrapper
*/
public RecordFolderAPI(RMRestWrapper rmRestWrapper)
{
super(rmRestWrapper);
}
/**
* Deletes a record folder.
*
* @param recordFolderId The identifier of a record folder
* @throws Exception for the following cases:
* <ul>
* <li>{@code recordFolderId} is not a valid format</li>
* <li>authentication fails</li>
* <li>current user does not have permission to delete {@code recordFolderId}</li>
* <li>{@code recordFolderId} does not exist</li>
* <li>{@code recordFolderId} is locked and cannot be deleted</li>
* </ul>
*/
public void deleteRecordFolder(String recordFolderId)
{
mandatoryString("recordFolderId", recordFolderId);
getRmRestWrapper().processEmptyModel(simpleRequest(
DELETE,
"record-folders/{recordFolderId}",
recordFolderId
));
}
/**
* see {@link #getRecordFolder(String, String)}
*/
public RecordFolder getRecordFolder(String recordFolderId)
{
mandatoryString("recordFolderId", recordFolderId);
return getRecordFolder(recordFolderId, EMPTY);
}
/**
* Gets a record folder.
*
* @param recordFolderId The identifier of a record folder
* @param parameters The URL parameters to add
* @return The {@link RecordFolder} for the given {@code recordFolderId}
* @throws Exception for the following cases:
* <ul>
* <li>{@code recordFolderId} is not a valid format</li>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code recordFolderId}</li>
* <li>{@code recordFolderId} does not exist</li>
* </ul>
*/
public RecordFolder getRecordFolder(String recordFolderId, String parameters)
{
mandatoryString("recordFolderId", recordFolderId);
return getRmRestWrapper().processModel(RecordFolder.class, simpleRequest(
GET,
"record-folders/{recordFolderId}?{parameters}",
recordFolderId,
parameters
));
}
/**
* see {@link #updateRecordFolder(RecordFolder, String, String)
*/
public RecordFolder updateRecordFolder(RecordFolder recordFolderModel, String recordFolderId) throws Exception
{
mandatoryObject("recordFolderModel", recordFolderModel);
mandatoryString("recordFolderId", recordFolderId);
return updateRecordFolder(recordFolderModel, recordFolderId, EMPTY);
}
/**
* Updates a record folder.
*
* @param recordFolderModel The record folder model which holds the information
* @param recordFolderId The identifier of a record folder
* @param parameters The URL parameters to add
* @param returns The updated {@link RecordFolder}
* @throws Exception for the following cases:
* <ul>
* <li>the update request is invalid or {@code recordFolderId} is not a valid format or {@code recordFolderModel} is invalid</li>
* <li>authentication fails</li>
* <li>current user does not have permission to update {@code recordFolderId}</li>
* <li>{@code recordFolderId} does not exist</li>
* <li>the updated name clashes with an existing record folder in the current parent category</li>
* <li>model integrity exception, including file name with invalid characters</li>
* </ul>
*/
public RecordFolder updateRecordFolder(RecordFolder recordFolderModel, String recordFolderId, String parameters) throws Exception
{
mandatoryObject("recordFolderModel", recordFolderModel);
mandatoryString("recordFolderId", recordFolderId);
return getRmRestWrapper().processModel(RecordFolder.class, requestWithBody(
PUT,
toJson(recordFolderModel),
"record-folders/{recordFolderId}?{parameters}",
recordFolderId,
parameters
));
}
/**
* see {@link #getRecordFolderChildren(String, String)}
*/
public RecordFolderCollection getRecordFolderChildren(String recordFolderId)
{
mandatoryString("recordFolderId", recordFolderId);
return getRecordFolderChildren(recordFolderId, EMPTY);
}
/**
* Gets the children of a record folder.
*
* @param recordFolderId The identifier of a record folder
* @param parameters The URL parameters to add
* @return The {@link RecordFolderCollection} for the given {@code recordFolderId}
* @throws Exception for the following cases:
* <ul>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code recordFolderId}</li>
* <li>{@code recordFolderId} does not exist</li>
*</ul>
*/
public RecordFolderCollection getRecordFolderChildren(String recordFolderId, String parameters)
{
mandatoryString("recordFolderId", recordFolderId);
return getRmRestWrapper().processModels(RecordFolderCollection.class, simpleRequest(
GET,
"record-folders/{recordFolderId}/records?{parameters}",
recordFolderId,
parameters
));
}
/**
* see {@link #createRecord(Record, String, String)}
*/
public Record createRecord(Record recordModel, String recordFolderId) throws Exception
{
mandatoryObject("recordModel", recordModel);
mandatoryString("recordFolderId", recordFolderId);
return createRecord(recordModel, recordFolderId, EMPTY);
}
/**
* Create a record from file resource
*
* @param electronicRecordModel {@link Record} for electronic record to be created
* @param recordContent {@link File} pointing to the content of the electronic record to be created
* @param recordFolderId The identifier of a record folder
* @return newly created {@link Record}
* @throws Exception for invalid recordModel JSON strings
*/
public Record createRecord(Record recordModel, String recordFolderId, File recordContent) throws Exception
{
mandatoryString("recordFolderId", recordFolderId);
mandatoryObject("recordContent", recordContent);
mandatoryObject("recordModel", recordModel);
if (!recordModel.getNodeType().equals(CONTENT_TYPE))
{
fail("Only electronic records are supported");
}
/*
* For file uploads nodeBodyCreate is ignored hence can't be used. Append all Record fields
* to the request.
*/
RequestSpecBuilder builder = getRmRestWrapper().configureRequestSpec();
JsonNode root = new ObjectMapper().readTree(toJson(recordModel, Record.class, FilePlanComponentMixIn.class));
// add request fields
Iterator<String> fieldNames = root.fieldNames();
while (fieldNames.hasNext())
{
String fieldName = fieldNames.next();
builder.addMultiPart(fieldName, root.get(fieldName).asText(), ContentType.JSON.name());
}
builder.addMultiPart("filedata", recordContent, ContentType.BINARY.name());
// create node with given content
return createRecord(recordModel, recordFolderId);
}
/**
* Creates a record in a record folder child, i.e. a record.
*
* @param recordModel The record model which holds the information
* @param recordfolderId The identifier of a record folder
* @param parameters The URL parameters to add
* @return The created {@link Record}
* @throws Exception for the following cases:
* <ul>
* <li>{@code recordFolderId is not a valid format or {@code recordModel} is invalid</li>
* <li>authentication fails</li>
* <li>current user does not have permission to add children to {@code recordFolderId}</li>
* <li>{@code recordFolderId} does not exist</li>
* <li>model integrity exception, including node name with invalid characters</li>
* </ul>
*/
public Record createRecord(Record recordModel, String recordFolderId, String parameters) throws Exception
{
mandatoryObject("recordModel", recordModel);
mandatoryString("recordFolderId", recordFolderId);
return getRmRestWrapper().processModel(Record.class, requestWithBody(
POST,
toJson(recordModel),
"record-folders/{recordFolderId}/records?{parameters}",
recordFolderId,
parameters
));
}
}

View File

@@ -24,35 +24,32 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.rm.community.requests.igCoreAPI;
package org.alfresco.rest.rm.community.requests.gscore.api;
import static com.jayway.restassured.RestAssured.given;
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.apache.commons.lang3.StringUtils.EMPTY;
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 com.jayway.restassured.response.ResponseBody;
import org.alfresco.rest.core.RMRestWrapper;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
import org.alfresco.rest.rm.community.model.fileplancomponents.RecordBodyFile;
import org.alfresco.rest.rm.community.model.record.Record;
import org.alfresco.rest.rm.community.model.record.RecordBodyFile;
import org.alfresco.rest.rm.community.requests.RMModelRequest;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* Records REST API Wrapper
* Records REST API Wrapper
*
* @author Rodica Sutu
* @since 2.6
*/
@Component
@Scope (value = "prototype")
public class RecordsAPI extends RMModelRequest
{
/**
@@ -79,11 +76,11 @@ public class RecordsAPI extends RMModelRequest
public ResponseBody<?> getRecordContent(String recordId) throws Exception
{
mandatoryString("recordId", recordId);
return getRMRestWrapper()
return getRmRestWrapper()
.processHtmlResponse(simpleRequest(GET,"records/{recordId}/content", recordId))
.getBody();
}
/**
@@ -91,7 +88,7 @@ public class RecordsAPI extends RMModelRequest
*
* @param recordBodyFile The properties where to file the record
* @param recordId The id of the record to file
* @return The {@link FilePlanComponent} with the given properties
* @return The {@link Record} with the given properties
* @throws Exception for the following cases:
* <ul>
* <li>Invalid parameter: {@code recordBodyFile} is not a valid format,{@code recordId} is not a record</li>
@@ -103,7 +100,7 @@ public class RecordsAPI extends RMModelRequest
* </ul>
*
*/
public FilePlanComponent fileRecord(RecordBodyFile recordBodyFile, String recordId) throws Exception
public Record fileRecord(RecordBodyFile recordBodyFile, String recordId) throws Exception
{
mandatoryObject("recordBodyFile", recordBodyFile);
mandatoryString("recordId", recordId);
@@ -116,7 +113,7 @@ public class RecordsAPI extends RMModelRequest
*
* @param recordBodyFile The properties where to file the record
* @param recordId The id of the record to file
* @return The {@link FilePlanComponent} with the given properties
* @return The {@link Record} with the given properties
* @throws Exception for the following cases:
* <ul>
* <li>Invalid parameter: {@code recordBodyFile} is not a valid format,{@code recordId} is not a record</li>
@@ -128,12 +125,12 @@ public class RecordsAPI extends RMModelRequest
* </ul>
*
*/
public FilePlanComponent fileRecord(RecordBodyFile recordBodyFile, String recordId, String parameters) throws Exception
public Record fileRecord(RecordBodyFile recordBodyFile, String recordId, String parameters) throws Exception
{
mandatoryObject("requestBodyFile", recordBodyFile);
mandatoryString("recordId", recordId);
return getRMRestWrapper().processModel(FilePlanComponent.class, requestWithBody(
return getRmRestWrapper().processModel(Record.class, requestWithBody(
POST,
toJson(recordBodyFile),
"/records/{recordId}/file?{parameters}",
@@ -141,5 +138,106 @@ public class RecordsAPI extends RMModelRequest
parameters
));
}
}
/**
* Deletes a record.
*
* @param recordId The identifier of a record
* @throws Exception for the following cases:
* <ul>
* <li>{@code recordId} is not a valid format</li>
* <li>authentication fails</li>
* <li>current user does not have permission to delete {@code recordId}</li>
* <li>{@code recordId} does not exist</li>
* <li>{@code recordId} is locked and cannot be deleted</li>
* </ul>
*/
public void deleteRecord(String recordId)
{
mandatoryString("recordId", recordId);
getRmRestWrapper().processEmptyModel(simpleRequest(
DELETE,
"records/{recordId}",
recordId
));
}
/**
* see {@link #getRecord(String, String)}
*/
public Record getRecord(String recordId)
{
mandatoryString("recordId", recordId);
return getRecord(recordId, EMPTY);
}
/**
* Gets a record.
*
* @param recordId The identifier of a record
* @param parameters The URL parameters to add
* @return The {@link Record} for the given {@code recordId}
* @throws Exception for the following cases:
* <ul>
* <li>{@code recordId} is not a valid format</li>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code recordId}</li>
* <li>{@code recordId} does not exist</li>
* </ul>
*/
public Record getRecord(String recordId, String parameters)
{
mandatoryString("recordId", recordId);
return getRmRestWrapper().processModel(Record.class, simpleRequest(
GET,
"records/{recordId}?{parameters}",
recordId,
parameters
));
}
/**
* see {@link #updateRecord(Record, String, String)
*/
public Record updateRecord(Record recordModel, String recordId) throws Exception
{
mandatoryObject("recordModel", recordModel);
mandatoryString("recordId", recordId);
return updateRecord(recordModel, recordId, EMPTY);
}
/**
* Updates a record.
*
* @param recordModel The record model which holds the information
* @param recordId The identifier of a record
* @param parameters The URL parameters to add
* @param returns The updated {@link Record}
* @throws Exception for the following cases:
* <ul>
* <li>the update request is invalid or {@code recordId} is not a valid format or {@code recordModel} is invalid</li>
* <li>authentication fails</li>
* <li>current user does not have permission to update {@code recordId}</li>
* <li>{@code recordId} does not exist</li>
* <li>the updated name clashes with an existing record in the current parent folder</li>
* <li>model integrity exception, including file name with invalid characters</li>
* </ul>
*/
public Record updateRecord(Record recordModel, String recordId, String parameters) throws Exception
{
mandatoryObject("recordModel", recordModel);
mandatoryString("recordId", recordId);
return getRmRestWrapper().processModel(Record.class, requestWithBody(
PUT,
toJson(recordModel),
"records/{recordId}?{parameters}",
recordId,
parameters
));
}
}

View File

@@ -0,0 +1,125 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.requests.gscore.api;
import static org.alfresco.rest.core.RestRequest.simpleRequest;
import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString;
import static org.apache.commons.lang3.StringUtils.EMPTY;
import static org.springframework.http.HttpMethod.GET;
import org.alfresco.rest.core.RMRestWrapper;
import org.alfresco.rest.rm.community.model.transfer.Transfer;
import org.alfresco.rest.rm.community.model.transfer.TransferChildCollection;
import org.alfresco.rest.rm.community.requests.RMModelRequest;
/**
* Transfer REST API Wrapper
*
* @author Silviu Dinuta
* @since 2.6
*/
public class TransferAPI extends RMModelRequest
{
/**
* @param rmRestWrapper
*/
public TransferAPI(RMRestWrapper rmRestWrapper)
{
super(rmRestWrapper);
}
/**
* see {@link #getTransfer(String, String)}
*/
public Transfer getTransfer(String transferId)
{
mandatoryString("transferId", transferId);
return getTransfer(transferId, EMPTY);
}
/**
* Gets a transfer.
*
* @param transferId The identifier of a transfer
* @param parameters The URL parameters to add
* @return The {@link Transfer} for the given {@code transferId}
* @throws Exception for the following cases:
* <ul>
* <li>{@code transferId} is not a valid format</li>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code transferId}</li>
* <li>{@code transferId} does not exist</li>
* </ul>
*/
public Transfer getTransfer(String transferId, String parameters)
{
mandatoryString("transferId", transferId);
return getRmRestWrapper().processModel(Transfer.class, simpleRequest(
GET,
"/transfers/{transferId}?{parameters}",
transferId,
parameters
));
}
/**
* see {@link #getTransfersChildren(String, String)}
*/
public TransferChildCollection getTransfersChildren(String transferId)
{
mandatoryString("transferId", transferId);
return getTransfersChildren(transferId, EMPTY);
}
/**
* Gets the children (record folder or record) of a transfer.
*
* @param transferId The identifier of a transfer
* @param parameters The URL parameters to add
* @return The {@link TransferChildCollection} for the given {@code transferId}
* @throws Exception for the following cases:
* <ul>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code transferId}</li>
* <li>{@code filePlanId} does not exist</li>
*</ul>
*/
public TransferChildCollection getTransfersChildren(String transferId, String parameters)
{
mandatoryString("transferId", transferId);
return getRmRestWrapper().processModels(TransferChildCollection.class, simpleRequest(
GET,
"transfers/{filePlanId}/children?{parameters}",
transferId,
parameters
));
}
}

View File

@@ -0,0 +1,172 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.requests.gscore.api;
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.apache.commons.lang3.StringUtils.EMPTY;
import static org.springframework.http.HttpMethod.GET;
import static org.springframework.http.HttpMethod.PUT;
import org.alfresco.rest.core.RMRestWrapper;
import org.alfresco.rest.rm.community.model.transfer.TransferCollection;
import org.alfresco.rest.rm.community.model.transfercontainer.TransferContainer;
import org.alfresco.rest.rm.community.requests.RMModelRequest;
/**
* Transfer Container REST API Wrapper
*
* @author Silviu Dinuta
* @since 2.6
*/
public class TransferContainerAPI extends RMModelRequest
{
/**
* @param rmRestWrapper
*/
public TransferContainerAPI(RMRestWrapper rmRestWrapper)
{
super(rmRestWrapper);
}
/**
* see {@link #getTransferContainer(String, String)}
*/
public TransferContainer getTransferContainer(String transferContainerId)
{
mandatoryString("transferContainerId", transferContainerId);
return getTransferContainer(transferContainerId, EMPTY);
}
/**
* Gets a transfer container.
*
* @param transferContainerId The identifier of a transfer container
* @param parameters The URL parameters to add
* @return The {@link TransferContainer} for the given {@code transferContainerId}
* @throws Exception for the following cases:
* <ul>
* <li>{@code transferContainerId} is not a valid format</li>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code transferContainerId}</li>
* <li>{@code transferContainerId} does not exist</li>
* </ul>
*/
public TransferContainer getTransferContainer(String transferContainerId, String parameters)
{
mandatoryString("transferContainerId", transferContainerId);
return getRmRestWrapper().processModel(TransferContainer.class, simpleRequest(
GET,
"/transfer-containers/{transferContainerId}?{parameters}",
transferContainerId,
parameters
));
}
/**
* see {@link #updateTransferContainer(TransferContainer, String, String)
*/
public TransferContainer updateTransferContainer(TransferContainer transferContainerModel, String transferContainerId) throws Exception
{
mandatoryObject("transferContainerModel", transferContainerModel);
mandatoryString("transferContainerId", transferContainerId);
return updateTransferContainer(transferContainerModel, transferContainerId, EMPTY);
}
/**
* Updates a transfer container.
*
* @param transferContainerModel The transfer container model which holds the information
* @param transferContainerId The identifier of a transfer container
* @param parameters The URL parameters to add
* @param returns The updated {@link TransferContainer}
* @throws Exception for the following cases:
* <ul>
* <li>the update request is invalid or {@code transferContainerId} is not a valid format or {@code transferContainerModel} is invalid</li>
* <li>authentication fails</li>
* <li>current user does not have permission to update {@code transferContainerId}</li>
* <li>{@code transferContainerId} does not exist</li>
* <li>the updated name clashes with an existing transfer container in the current file plan</li>
* <li>model integrity exception, including transfer container name with invalid characters</li>
* </ul>
*/
public TransferContainer updateTransferContainer(TransferContainer transferContainerModel, String transferContainerId, String parameters) throws Exception
{
mandatoryObject("transferContainerModel", transferContainerModel);
mandatoryString("transferContainerId", transferContainerId);
return getRmRestWrapper().processModel(TransferContainer.class, requestWithBody(
PUT,
toJson(transferContainerModel),
"transfer-containers/{transferContainerId}?{parameters}",
transferContainerId,
parameters
));
}
/**
* see {@link #getTransfers(String, String)}
*/
public TransferCollection getTransfers(String transferContainerId)
{
mandatoryString("transferContainerId", transferContainerId);
return getTransfers(transferContainerId, EMPTY);
}
/**
* Gets the children (transfers) of a transfer container.
*
* @param transferContainerId The identifier of a transfer container
* @param parameters The URL parameters to add
* @return The {@link TransferCollection} for the given {@code transferContainerId}
* @throws Exception for the following cases:
* <ul>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code transferContainerId}</li>
* <li>{@code filePlanId} does not exist</li>
*</ul>
*/
public TransferCollection getTransfers(String transferContainerId, String parameters)
{
mandatoryString("transferContainerId", transferContainerId);
return getRmRestWrapper().processModels(TransferCollection.class, simpleRequest(
GET,
"transfer-containers/{filePlanId}/transfers?{parameters}",
transferContainerId,
parameters
));
}
}

View File

@@ -0,0 +1,268 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.requests.gscore.api;
import static org.alfresco.rest.core.RestRequest.requestWithBody;
import static org.alfresco.rest.core.RestRequest.simpleRequest;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
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.apache.commons.lang3.StringUtils.EMPTY;
import static org.springframework.http.HttpMethod.GET;
import static org.springframework.http.HttpMethod.POST;
import static org.springframework.http.HttpMethod.PUT;
import static org.testng.Assert.fail;
import java.io.File;
import java.util.Iterator;
import org.alfresco.rest.core.RMRestWrapper;
import org.alfresco.rest.rm.community.model.record.Record;
import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainer;
import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildCollection;
import org.alfresco.rest.rm.community.requests.RMModelRequest;
import org.alfresco.rest.rm.community.util.FilePlanComponentMixIn;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.http.ContentType;
/**
* Unfiled Container REST API Wrapper
*
* @author Tuna Aksoy
* @author Ana Bozianu
* @since 2.6
*/
public class UnfiledContainerAPI extends RMModelRequest
{
/**
* @param rmRestWrapper
*/
public UnfiledContainerAPI(RMRestWrapper rmRestWrapper)
{
super(rmRestWrapper);
}
/**
* see {@link #getUnfiledContainer(String, String)}
*/
public UnfiledContainer getUnfiledContainer(String unfiledContainerId)
{
mandatoryString("unfiledContainerId", unfiledContainerId);
return getUnfiledContainer(unfiledContainerId, EMPTY);
}
/**
* Gets an unfiled record container.
*
* @param unfiledContainerId The identifier of a unfiled record container
* @param parameters The URL parameters to add
* @return The {@link UnfiledContainer} for the given {@code unfiledContainerId}
* @throws Exception for the following cases:
* <ul>
* <li>{@code unfiledContainerId} is not a valid format</li>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code unfiledContainerId}</li>
* <li>{@code unfiledContainerId} does not exist</li>
* </ul>
*/
public UnfiledContainer getUnfiledContainer(String unfiledContainerId, String parameters)
{
mandatoryString("unfiledContainerId", unfiledContainerId);
return getRmRestWrapper().processModel(UnfiledContainer.class, simpleRequest(
GET,
"unfiled-containers/{unfiledContainerId}?{parameters}",
unfiledContainerId,
parameters
));
}
/**
* see {@link #getRootRecordCategories(String, String)}
*/
public UnfiledContainerChildCollection getUnfiledContainerChildren(String unfiledContainerId)
{
mandatoryString("unfiledContainerId", unfiledContainerId);
return getUnfiledContainerChildren(unfiledContainerId, EMPTY);
}
/**
* Gets the children of an unfiled records container
*
* @param unfiledContainerId The identifier of an unfiled records container
* @param parameters The URL parameters to add
* @return The {@link UnfiledContainerChildCollection} for the given {@code unfiledContainerId}
* @throws Exception for the following cases:
* <ul>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code unfiledContainerId}</li>
* <li>{@code unfiledContainerId} does not exist</li>
*</ul>
*/
public UnfiledContainerChildCollection getUnfiledContainerChildren(String unfiledContainerId, String parameters)
{
mandatoryString("unfiledContainerId", unfiledContainerId);
return getRmRestWrapper().processModels(UnfiledContainerChildCollection.class, simpleRequest(
GET,
"unfiled-containers/{unfiledContainerId}/children?{parameters}",
unfiledContainerId,
parameters
));
}
/**
* see {@link #createUnfiledContainerChild(UnfiledContainerChild, String, String)}
*/
public UnfiledContainerChild createUnfiledContainerChild(UnfiledContainerChild unfiledContainerChildModel, String unfiledContainerId) throws Exception
{
mandatoryObject("unfiledContainerChildModel", unfiledContainerChildModel);
mandatoryString("unfiledContainerId", unfiledContainerId);
return createUnfiledContainerChild(unfiledContainerChildModel, unfiledContainerId, EMPTY);
}
/**
* Creates an unfiled container child. Can be a record or an unfiled record folder.
*
* @param unfiledContainerChildModel The unfiled container child model which holds the information
* @param unfiledContainerId The identifier of an unfiled container
* @param parameters The URL parameters to add
* @return The created {@link UnfiledContainerChild}
* @throws Exception for the following cases:
* <ul>
* <li>{@code unfiledContainerId} is not a valid format or {@code unfiledContainerChildModel} is invalid</li>
* <li>authentication fails</li>
* <li>current user does not have permission to add children to {@code unfiledContainerId}</li>
* <li>{@code unfiledContainerId} 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 UnfiledContainerChild createUnfiledContainerChild(UnfiledContainerChild unfiledContainerChildModel, String unfiledContainerId, String parameters) throws Exception
{
mandatoryObject("unfiledContainerChildModel", unfiledContainerChildModel);
mandatoryString("unfiledContainerId", unfiledContainerId);
return getRmRestWrapper().processModel(UnfiledContainerChild.class, requestWithBody(
POST,
toJson(unfiledContainerChildModel),
"unfiled-containers/{unfiledContainerId}/children?{parameters}",
unfiledContainerId,
parameters
));
}
/**
* Create a record from file resource
*
* @param unfiledContainerChildModel {@link UnfiledContainerChild} for electronic record to be created
* @param unfiledContainerChildContent {@link File} pointing to the content of the electronic record to be created
* @param unfiledContainerId The identifier of a unfiled container
* @return newly created {@link UnfiledContainerChild}
* @throws Exception for invalid recordModel JSON strings
*/
public UnfiledContainerChild uploadRecord(UnfiledContainerChild unfiledContainerChildModel, String unfiledContainerId, File unfiledContainerChildContent) throws Exception
{
mandatoryObject("unfiledContainerChildModel", unfiledContainerChildModel);
mandatoryObject("unfiledContainerChildContent", unfiledContainerChildContent);
mandatoryString("unfiledContainerId", unfiledContainerId);
if (!unfiledContainerChildModel.getNodeType().equals(CONTENT_TYPE))
{
fail("Only electronic records are supported");
}
/*
* For file uploads nodeBodyCreate is ignored hence can't be used. Append all Record fields
* to the request.
*/
RequestSpecBuilder builder = getRmRestWrapper().configureRequestSpec();
JsonNode root = new ObjectMapper().readTree(toJson(unfiledContainerChildModel, Record.class, FilePlanComponentMixIn.class));
// add request fields
Iterator<String> fieldNames = root.fieldNames();
while (fieldNames.hasNext())
{
String fieldName = fieldNames.next();
builder.addMultiPart(fieldName, root.get(fieldName).asText(), ContentType.JSON.name());
}
builder.addMultiPart("filedata", unfiledContainerChildContent, ContentType.BINARY.name());
// create node with given content
return createUnfiledContainerChild(unfiledContainerChildModel, unfiledContainerId);
}
/**
* see {@link #updateUnfiledContainer(UnfiledContainer, String, String)
*/
public UnfiledContainer updateUnfiledContainer(UnfiledContainer unfiledContainerModel, String unfiledContainerId) throws Exception
{
mandatoryObject("unfiledContainerModel", unfiledContainerModel);
mandatoryString("unfiledContainerId", unfiledContainerId);
return updateUnfiledContainer(unfiledContainerModel, unfiledContainerId, EMPTY);
}
/**
* Updates an unfiled record container
*
* @param unfiledContainerModel The unfiled record container model which holds the information
* @param unfiledContainerId The identifier of an unfiled record container
* @param parameters The URL parameters to add
* @param returns The updated {@link UnfiledContainer}
* @throws Exception for the following cases:
* <ul>
* <li>the update request is invalid or {@code unfiledContainerId} is not a valid format or {@code unfiledContainerModel} is invalid</li>
* <li>authentication fails</li>
* <li>current user does not have permission to update {@code unfiledContainerId}</li>
* <li>{@code unfiledContainerId} does not exist</li>
* <li>the updated name clashes with an existing root category of special container in the current fileplan</li>
* <li>model integrity exception, including file name with invalid characters</li>
* </ul>
*/
public UnfiledContainer updateUnfiledContainer(UnfiledContainer unfiledContainerModel, String unfiledContainerId, String parameters) throws Exception
{
mandatoryObject("unfiledContainerModel", unfiledContainerModel);
mandatoryString("unfiledContainerId", unfiledContainerId);
return getRmRestWrapper().processModel(UnfiledContainer.class, requestWithBody(
PUT,
toJson(unfiledContainerModel),
"unfiled-containers/{unfiledContainerId}?{parameters}",
unfiledContainerId,
parameters
));
}
}

View File

@@ -0,0 +1,292 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.requests.gscore.api;
import static org.alfresco.rest.core.RestRequest.requestWithBody;
import static org.alfresco.rest.core.RestRequest.simpleRequest;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
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.apache.commons.lang3.StringUtils.EMPTY;
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 static org.testng.Assert.fail;
import java.io.File;
import java.util.Iterator;
import org.alfresco.rest.core.RMRestWrapper;
import org.alfresco.rest.rm.community.model.record.Record;
import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildCollection;
import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledRecordFolder;
import org.alfresco.rest.rm.community.requests.RMModelRequest;
import org.alfresco.rest.rm.community.util.FilePlanComponentMixIn;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.http.ContentType;
/**
* Unfiled Record Folders REST API Wrapper
*
* @author Ramona Popa
* @since 2.6
*/
public class UnfiledRecordFolderAPI extends RMModelRequest
{
/**
* @param rmRestWrapper
*/
public UnfiledRecordFolderAPI(RMRestWrapper rmRestWrapper)
{
super(rmRestWrapper);
}
/**
* see {@link #getUnfiledRecordFolder(String, String)}
*/
public UnfiledRecordFolder getUnfiledRecordFolder(String unfiledRecordFolderId)
{
mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId);
return getUnfiledRecordFolder(unfiledRecordFolderId, EMPTY);
}
/**
* Gets an unfiled record folder.
*
* @param unfiledRecordFolderId The identifier of a unfiled record folder
* @param parameters The URL parameters to add
* @return The {@link UnfiledRecordFolder} for the given {@code unfiledRecordFolderId}
* @throws Exception for the following cases:
* <ul>
* <li>{@code unfiledRecordFolderId} is not a valid format</li>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code unfiledRecordFolderId}</li>
* <li>{@code unfiledRecordFolderId} does not exist</li>
* </ul>
*/
public UnfiledRecordFolder getUnfiledRecordFolder(String unfiledRecordFolderId, String parameters)
{
mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId);
return getRmRestWrapper().processModel(UnfiledRecordFolder.class, simpleRequest(
GET,
"unfiled-record-folders/{unfiledRecordFolderId}?{parameters}",
unfiledRecordFolderId,
parameters
));
}
/**
* see {@link #getUnfiledRecordFolderChildren(String, String)}
*/
public UnfiledContainerChildCollection getUnfiledRecordFolderChildren(String unfiledRecordFolderId)
{
mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId);
return getUnfiledRecordFolderChildren(unfiledRecordFolderId, EMPTY);
}
/**
* Gets the children of an unfiled record folder
*
* @param unfiledRecordFolderId The identifier of an unfiled records folder
* @param parameters The URL parameters to add
* @return The {@link UnfiledRecordFolderChildCollection} for the given {@code unfiledRecordFolderId}
* @throws Exception for the following cases:
* <ul>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code unfiledRecordFolderId}</li>
* <li>{@code unfiledRecordFolderId} does not exist</li>
*</ul>
*/
public UnfiledContainerChildCollection getUnfiledRecordFolderChildren(String unfiledRecordFolderId, String parameters)
{
mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId);
return getRmRestWrapper().processModels(UnfiledContainerChildCollection.class, simpleRequest(
GET,
"unfiled-record-folders/{unfiledRecordFolderId}/children?{parameters}",
unfiledRecordFolderId,
parameters
));
}
/**
* see {@link #createUnfiledRecordFolderChild(UnfiledContainerChild, String, String)}
*/
public UnfiledContainerChild createUnfiledRecordFolderChild(UnfiledContainerChild unfiledRecordFolderChildModel, String unfiledRecordFolderId) throws Exception
{
mandatoryObject("unfiledRecordFolderChildModel", unfiledRecordFolderChildModel);
mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId);
return createUnfiledRecordFolderChild(unfiledRecordFolderChildModel, unfiledRecordFolderId, EMPTY);
}
/**
* Creates an unfiled record folder child. Can be a record or an unfiled record folder.
*
* @param unfiledRecordFolderChildModel The unfiled folder child model which holds the information
* @param unfiledRecordFolderId The identifier of an unfiled folder
* @param parameters The URL parameters to add
* @return The created {@link UnfiledRecordFolderChild}
* @throws Exception for the following cases:
* <ul>
* <li>{@code unfiledRecordFolderId} is not a valid format or {@code unfiledRecordFolderChildModel} is invalid</li>
* <li>authentication fails</li>
* <li>current user does not have permission to add children to {@code unfiledRecordFolderId}</li>
* <li>{@code unfiledRecordFolderId} 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 UnfiledContainerChild createUnfiledRecordFolderChild(UnfiledContainerChild unfiledRecordFolderChildModel, String unfiledRecordFolderId, String parameters) throws Exception
{
mandatoryObject("unfiledRecordFolderChildModel", unfiledRecordFolderChildModel);
mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId);
return getRmRestWrapper().processModel(UnfiledContainerChild.class, requestWithBody(
POST,
toJson(unfiledRecordFolderChildModel),
"unfiled-record-folders/{unfiledRecordFolderId}/children?{parameters}",
unfiledRecordFolderId,
parameters
));
}
/**
* Create a record from file resource
*
* @param unfiledRecordFolderChildModel {@link UnfiledContainerChild} for electronic record to be created
* @param unfiledRecordFolderChildContent {@link File} pointing to the content of the electronic record to be created
* @param unfiledRecordFolderId The identifier of a unfiled record folder
* @return newly created {@link UnfiledContainerChild}
* @throws Exception for invalid recordModel JSON strings
*/
public UnfiledContainerChild uploadRecord(UnfiledContainerChild unfiledRecordFolderChildModel, String unfiledRecordFolderId, File unfiledRecordFolderChildContent) throws Exception
{
mandatoryObject("unfiledRecordFolderChildModel", unfiledRecordFolderChildModel);
mandatoryObject("unfiledRecordFolderChildContent", unfiledRecordFolderChildContent);
mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId);
if (!unfiledRecordFolderChildModel.getNodeType().equals(CONTENT_TYPE))
{
fail("Only electronic records are supported");
}
/*
* For file uploads nodeBodyCreate is ignored hence can't be used. Append all Record fields
* to the request.
*/
RequestSpecBuilder builder = getRmRestWrapper().configureRequestSpec();
JsonNode root = new ObjectMapper().readTree(toJson(unfiledRecordFolderChildModel, Record.class, FilePlanComponentMixIn.class));
// add request fields
Iterator<String> fieldNames = root.fieldNames();
while (fieldNames.hasNext())
{
String fieldName = fieldNames.next();
builder.addMultiPart(fieldName, root.get(fieldName).asText(), ContentType.JSON.name());
}
builder.addMultiPart("filedata", unfiledRecordFolderChildContent, ContentType.BINARY.name());
// create node with given content
return createUnfiledRecordFolderChild(unfiledRecordFolderChildModel, unfiledRecordFolderId);
}
/**
* see {@link #updateUnfiledRecordFolder(UnfiledRecordFolder, String, String)
*/
public UnfiledRecordFolder updateUnfiledRecordFolder(UnfiledRecordFolder unfiledRecordFolderModel, String unfiledRecordFolderId) throws Exception
{
mandatoryObject("unfiledRecordFolderModel", unfiledRecordFolderModel);
mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId);
return updateUnfiledRecordFolder(unfiledRecordFolderModel, unfiledRecordFolderId, EMPTY);
}
/**
* Updates an unfiled record folder
*
* @param unfiledRecordFolderModel The unfiled record folder model which holds the information
* @param unfiledRecordFolderId The identifier of an unfiled record folder
* @param parameters The URL parameters to add
* @param returns The updated {@link UnfiledRecordFolder}
* @throws Exception for the following cases:
* <ul>
* <li>the update request is invalid or {@code unfiledRecordFolderId} is not a valid format or {@code unfiledRecordFolderModel} is invalid</li>
* <li>authentication fails</li>
* <li>current user does not have permission to update {@code unfiledRecordFolderId}</li>
* <li>{@code unfiledRecordFolderId} does not exist</li>
* <li>the updated name clashes with an existing root category of special container in the current fileplan</li>
* <li>model integrity exception, including file name with invalid characters</li>
* </ul>
*/
public UnfiledRecordFolder updateUnfiledRecordFolder(UnfiledRecordFolder unfiledRecordFolderModel, String unfiledRecordFolderId, String parameters) throws Exception
{
mandatoryObject("unfiledRecordFolderModel", unfiledRecordFolderModel);
mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId);
return getRmRestWrapper().processModel(UnfiledRecordFolder.class, requestWithBody(
PUT,
toJson(unfiledRecordFolderModel),
"unfiled-record-folders/{unfiledRecordFolderId}?{parameters}",
unfiledRecordFolderId,
parameters
));
}
/**
* Deletes an unfiled record folder.
*
* @param unfiledRecordFolderId The identifier of a unfiled record folder
* @throws Exception for the following cases:
* <ul>
* <li>{@code unfiledRecordFolderId} is not a valid format</li>
* <li>authentication fails</li>
* <li>current user does not have permission to delete {@code unfiledRecordFolderId}</li>
* <li>{@code unfiledRecordFolderId} does not exist</li>
* <li>{@code unfiledRecordFolderId} is locked and cannot be deleted</li>
* </ul>
*/
public void deleteUnfiledRecordFolder(String unfiledRecordFolderId)
{
mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId);
getRmRestWrapper().processEmptyModel(simpleRequest(
DELETE,
"unfiled-record-folders/{recordFolderId}",
unfiledRecordFolderId
));
}
}

View File

@@ -1,351 +0,0 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.requests.igCoreAPI;
import static com.jayway.restassured.RestAssured.basic;
import static com.jayway.restassured.RestAssured.given;
import static org.alfresco.rest.core.RestRequest.requestWithBody;
import static org.alfresco.rest.core.RestRequest.simpleRequest;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
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.alfresco.rest.rm.community.util.PojoUtility.toJsonElectronicRecord;
import static org.apache.commons.lang3.StringUtils.EMPTY;
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 static org.testng.Assert.fail;
import java.io.File;
import java.util.Iterator;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.io.Resources;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.http.ContentType;
import org.alfresco.rest.core.RMRestWrapper;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
import org.alfresco.rest.rm.community.requests.RMModelRequest;
/**
* File plan component REST API Wrapper
*
* @author Tuna Aksoy
* @since 2.6
*/
public class FilePlanComponentAPI extends RMModelRequest
{
/**
* Constructor
*
* @param restWrapper
*/
public FilePlanComponentAPI(RMRestWrapper rmRestWrapper)
{
super(rmRestWrapper);
}
/**
* 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 getFilePlanComponent(filePlanComponentId, EMPTY);
}
/**
* Get a file plan component
*
* @param filePlanComponentId The id of the file plan component to get
* @param parameters The URL parameters to add
* @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, String parameters) throws Exception
{
mandatoryString("filePlanComponentId", filePlanComponentId);
return getRMRestWrapper().processModel(FilePlanComponent.class, simpleRequest(
GET,
"fileplan-components/{fileplanComponentId}?{parameters}",
filePlanComponentId,
parameters
));
}
/**
* 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 getRMRestWrapper().processModels(FilePlanComponentsCollection.class, simpleRequest(
GET,
"fileplan-components/{fileplanComponentId}/children",
filePlanComponentId
));
}
/**
* List child components of a file plan component
* @param parameters The URL parameters to add
* @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, String parameters) throws Exception
{
mandatoryString("filePlanComponentId", filePlanComponentId);
return getRMRestWrapper().processModels(FilePlanComponentsCollection.class, simpleRequest(
GET,
"fileplan-components/{fileplanComponentId}/children?{parameters}",
filePlanComponentId,parameters
));
}
/**
* 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 createFilePlanComponent(filePlanComponentModel, parentId, EMPTY);
}
/**
* 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 parameters The URL parameters to add
* @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, String parameters) throws Exception
{
mandatoryObject("filePlanComponentProperties", filePlanComponentModel);
mandatoryString("parentId", parentId);
return getRMRestWrapper().processModel(FilePlanComponent.class, requestWithBody(
POST,
toJson(filePlanComponentModel),
"fileplan-components/{fileplanComponentId}/children?{parameters}",
parentId,
parameters
));
}
/**
* Create electronic record from file resource
* @param electronicRecordModel {@link FilePlanComponent} for electronic record to be created
* @param fileName the name of the resource file
* @param parentId parent container id
* @return newly created {@link FilePlanComponent}
* @throws Exception if operation failed
*/
public FilePlanComponent createElectronicRecord(FilePlanComponent electronicRecordModel, String fileName, String parentId) throws Exception
{
return createElectronicRecord(electronicRecordModel, new File(Resources.getResource(fileName).getFile()), parentId);
}
/**
* Create electronic record from file resource
*
* @param electronicRecordModel {@link FilePlanComponent} for electronic record to be created
* @param recordContent {@link File} pointing to the content of the electronic record to be created
* @param parentId parent container id
* @return newly created {@link FilePlanComponent}
* @throws Exception for invalid electronicRecordModel JSON strings
*/
public FilePlanComponent createElectronicRecord(FilePlanComponent electronicRecordModel, File recordContent,
String parentId) throws Exception
{
mandatoryObject("electronicRecordModel", electronicRecordModel);
mandatoryString("parentId", parentId);
if (!electronicRecordModel.getNodeType().equals(CONTENT_TYPE))
{
fail("Only electronic records are supported");
}
/*
* For file uploads nodeBodyCreate is ignored hence can't be used. Append all FilePlanComponent fields
* to the request.
*/
RequestSpecBuilder builder = getRMRestWrapper().configureRequestSpec();
JsonNode root = new ObjectMapper().readTree(toJsonElectronicRecord(electronicRecordModel));
// add request fields
Iterator<String> fieldNames = root.fieldNames();
while (fieldNames.hasNext())
{
String fieldName = fieldNames.next();
builder.addMultiPart(fieldName, root.get(fieldName).asText(), ContentType.JSON.name());
}
builder.addMultiPart("filedata", recordContent, ContentType.BINARY.name());
// create node with given content
return createFilePlanComponent(electronicRecordModel, parentId);
}
/**
* Updates a file plan component
*
* @param filePlanComponentModel 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 filePlanComponentModel, String filePlanComponentId) throws Exception
{
mandatoryObject("filePlanComponentProperties", filePlanComponentModel);
mandatoryString("filePlanComponentId", filePlanComponentId);
return updateFilePlanComponent(filePlanComponentModel, filePlanComponentId, EMPTY);
}
/**
* Updates a file plan component
*
* @param filePlanComponent The properties to be updated
* @param parameters The URL parameters to add
* @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, String parameters) throws Exception
{
mandatoryObject("filePlanComponentProperties", filePlanComponent);
mandatoryString("filePlanComponentId", filePlanComponentId);
return getRMRestWrapper().processModel(FilePlanComponent.class, requestWithBody(
PUT,
toJson(filePlanComponent),
"fileplan-components/{fileplanComponentId}?{parameters}",
filePlanComponentId,
parameters
));
}
/**
* 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);
getRMRestWrapper().processEmptyModel(simpleRequest(
DELETE,
"fileplan-components/{fileplanComponentId}",
filePlanComponentId
));
}
}

View File

@@ -1,111 +0,0 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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.requests.igCoreAPI;
import static java.lang.Integer.parseInt;
import static java.lang.String.format;
import com.jayway.restassured.RestAssured;
import org.alfresco.rest.core.RMRestProperties;
import org.alfresco.rest.core.RMRestWrapper;
import org.alfresco.rest.rm.community.requests.RMModelRequest;
/**
* Defines the entire IG Core API
* {@link http://host:port/ig-api-explorer} select "IG Core API"
*
* @author Tuna Aksoy
* @since 2.6
*/
public class RestIGCoreAPI extends RMModelRequest
{
/**
* Constructor
*
* @param rmRestWrapper RM REST Wrapper
* @param rmRestProperties RM REST Properties
*/
public RestIGCoreAPI(RMRestWrapper rmRestWrapper, RMRestProperties rmRestProperties)
{
super(rmRestWrapper);
RestAssured.baseURI = format("%s://%s", rmRestProperties.getScheme(), rmRestProperties.getServer());
RestAssured.port = parseInt(rmRestProperties.getPort());
RestAssured.basePath = rmRestProperties.getRestRmPath();
restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath);
}
/**
* Provides DSL on all REST calls under <code>ig-sites/rm/...</code> API path
*
* @return {@link RMSiteAPI}
*/
public RMSiteAPI usingRMSite()
{
return new RMSiteAPI(getRMRestWrapper());
}
/**
* Provides DSL on all REST calls under <code>fileplan-components/...</code> API path
*
* @return {@link FilePlanComponentAPI}
*/
public FilePlanComponentAPI usingFilePlanComponents()
{
return new FilePlanComponentAPI(getRMRestWrapper());
}
/**
* Provides DSL on all REST calls under <code>records/...</code> API path
*
* @return {@link FilePlanComponentAPI}
*/
public RecordsAPI usingRecords()
{
return new RecordsAPI(getRMRestWrapper());
}
/**
* Provides DSL on all REST calls under <code>files/...</code> API path
*
* @return {@link FilesAPI}
*/
public FilesAPI usingFiles()
{
return new FilesAPI(getRMRestWrapper());
}
/**
* Provides DSL for RM user management API
*
* @return {@link RMUserAPI}
*/
public RMUserAPI usingRMUser()
{
return new RMUserAPI(getRMRestWrapper());
}
}

View File

@@ -28,10 +28,10 @@ package org.alfresco.rest.rm.community.util;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
import org.alfresco.rest.rm.community.model.record.RecordProperties;
/**
* Mix class for FilePlanComponent POJO class
* Mix class for Record POJO class
* Mix-in annotations are: a way to associate annotations with classes
* without modifying (target) classes themselves.
*
@@ -45,6 +45,5 @@ public abstract class FilePlanComponentMixIn
* Its properties are instead included as properties of its containing Object
*/
@JsonUnwrapped
abstract FilePlanComponentProperties getProperties();
abstract RecordProperties getProperties();
}

View File

@@ -26,12 +26,12 @@
*/
package org.alfresco.rest.rm.community.util;
import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
/**
* Utility class for creating the json object
*
@@ -41,51 +41,48 @@ import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent
public class PojoUtility
{
/**
* Converting object to JSON string
*
* @param model The java object model to convert
* see {@link #toJson(Object, Class, Class)}
*/
public static String toJson(Object model)
{
ObjectMapper mapper = new ObjectMapper();
//include only values that differ from default settings to be included
mapper.setSerializationInclusion(Include.NON_DEFAULT);
try
{
//return the json object
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(model);
}
catch (JsonProcessingException e)
{
return e.toString();
}
mandatoryObject("model", model);
return toJson(model, null, null);
}
/**
* Converting object to JSON string for electronic records
* Converting object to JSON string
*
* @param model The java object model to convert
* @throws JsonProcessingException Throws exceptions if the given object doesn't match to the POJO class model
* @param target Class (or interface) whose annotations to effectively override
* @param mixinSource Class (or interface) whose annotations are to be "added" to target's annotations, overriding as necessary
* @return The converted java object as JSON string
* @throws JsonProcessingException Throws exceptions if the given object doesn't match to the POJO class model
*/
public static String toJsonElectronicRecord(Object model)
public static String toJson(Object model, Class<?> target, Class<?> mixinSource)
{
mandatoryObject("model", model);
ObjectMapper mapper = new ObjectMapper();
//inject the "mix-in" annotations from FilePlanComponentMix to
// FilePlanComponent POJO class when converting to json
mapper.addMixIn(FilePlanComponent.class, FilePlanComponentMixIn.class);
if (target != null && mixinSource != null)
{
//inject the "mix-in" annotations from FilePlanComponentMix to
// FilePlanComponent POJO class when converting to json
mapper.addMixIn(target, mixinSource);
}
//include only values that differ from default settings to be included
mapper.setSerializationInclusion(Include.NON_DEFAULT);
//return the json object
try
{
//return the json object
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(model);
}
catch (JsonProcessingException e)
catch (JsonProcessingException error)
{
return e.toString();
return error.toString();
}
}
}

View File

@@ -33,15 +33,15 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentReviewPeriod;
import org.alfresco.rest.rm.community.model.common.ReviewPeriod;
/**
* Utility class for serializing the Review Period type
* Utility class for serializing @{FilePlanComponentReviewPeriod}
*
* @author Rodica Sutu
* @since 2.6
*/
public class ReviewPeriodSerializer extends JsonSerializer<FilePlanComponentReviewPeriod>
public class ReviewPeriodSerializer extends JsonSerializer<ReviewPeriod>
{
/**
* @param value The Review Period value that is being serialized.
@@ -51,7 +51,7 @@ public class ReviewPeriodSerializer extends JsonSerializer<FilePlanComponentRevi
* @throws JsonProcessingException
*/
@Override
public void serialize(FilePlanComponentReviewPeriod value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException
public void serialize(ReviewPeriod value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException
{
//create the custom string value for the Review Period type
gen.writeString(new StringBuilder().append(value.getPeriodType()).append("|").append(value.getExpression()).toString());

View File

@@ -1,2 +1,2 @@
alfresco.server=localhost
rest.rmPath=alfresco/api/-default-/public/ig/versions/1
rest.rmPath=alfresco/api/-default-/public/gs/versions/1