mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-4347 (Integrate rm-rest-api-automation in rm-ui-automation)
This commit is contained in:
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.model.fileplancomponents;
|
||||
|
||||
import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.ALLOWABLE_OPERATIONS;
|
||||
import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* POJO for file plan component
|
||||
*
|
||||
* @author Tuna Aksoy
|
||||
* @since 1.0
|
||||
*/
|
||||
//FIXME: Once the fields have been added the JsonIgnoreProperties annotation should be removed
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class FilePlanComponent
|
||||
{
|
||||
private String id;
|
||||
private String parentId;
|
||||
private String name;
|
||||
private String nodeType;
|
||||
private boolean isCategory;
|
||||
private boolean isRecordFolder;
|
||||
private boolean isFile;
|
||||
private boolean hasRetentionSchedule;
|
||||
private List<String> aspectNames;
|
||||
private FilePlanComponentCreatedByUser createdByUser;
|
||||
@JsonProperty(PROPERTIES)
|
||||
private FilePlanComponentProperties properties;
|
||||
@JsonProperty (ALLOWABLE_OPERATIONS)
|
||||
private List<String> allowableOperations;
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the parentId
|
||||
*/
|
||||
public String getParentId()
|
||||
{
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parentId the parentId to set
|
||||
*/
|
||||
public void setParentId(String parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nodeType
|
||||
*/
|
||||
public String getNodeType()
|
||||
{
|
||||
return this.nodeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodeType the nodeType to set
|
||||
*/
|
||||
public void setNodeType(String nodeType)
|
||||
{
|
||||
this.nodeType = nodeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isCategory
|
||||
*/
|
||||
public boolean isIsCategory()
|
||||
{
|
||||
return this.isCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isCategory the isCategory to set
|
||||
*/
|
||||
public void setCategory(boolean isCategory)
|
||||
{
|
||||
this.isCategory = isCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isRecordFolder
|
||||
*/
|
||||
public boolean isIsRecordFolder()
|
||||
{
|
||||
return this.isRecordFolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isRecordFolder the isRecordFolder to set
|
||||
*/
|
||||
public void setRecordFolder(boolean isRecordFolder)
|
||||
{
|
||||
this.isRecordFolder = isRecordFolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isFile
|
||||
*/
|
||||
public boolean isIsFile()
|
||||
{
|
||||
return this.isFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isFile the isFile to set
|
||||
*/
|
||||
public void setFile(boolean isFile)
|
||||
{
|
||||
this.isFile = isFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the hasRetentionSchedule
|
||||
*/
|
||||
public boolean isHasRetentionSchedule()
|
||||
{
|
||||
return this.hasRetentionSchedule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hasRetentionSchedule the hasRetentionSchedule to set
|
||||
*/
|
||||
public void setHasRetentionSchedule(boolean hasRetentionSchedule)
|
||||
{
|
||||
this.hasRetentionSchedule = hasRetentionSchedule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the properties
|
||||
*/
|
||||
public FilePlanComponentProperties getProperties()
|
||||
{
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param properties the properties to set
|
||||
*/
|
||||
public void setProperties(FilePlanComponentProperties properties)
|
||||
{
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the aspectNames
|
||||
*/
|
||||
public List<String> getAspectNames()
|
||||
{
|
||||
return this.aspectNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param aspectNames the aspectNames to set
|
||||
*/
|
||||
public void setAspectNames(List<String> aspectNames)
|
||||
{
|
||||
this.aspectNames = aspectNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the createdByUser
|
||||
*/
|
||||
public FilePlanComponentCreatedByUser getCreatedByUser()
|
||||
{
|
||||
return this.createdByUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param createdByUser the createdByUser to set
|
||||
*/
|
||||
public void setCreatedByUser(FilePlanComponentCreatedByUser createdByUser)
|
||||
{
|
||||
this.createdByUser = createdByUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the allowableOperations
|
||||
*/
|
||||
public List<String> getAllowableOperations()
|
||||
{
|
||||
return this.allowableOperations;
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.model.fileplancomponents;
|
||||
|
||||
import static org.alfresco.rest.util.ParameterCheck.mandatoryString;
|
||||
|
||||
/**
|
||||
* File plan component alias enumeration
|
||||
*
|
||||
* @author Tuna Aksoy
|
||||
* @since 1.0
|
||||
*/
|
||||
public enum FilePlanComponentAlias
|
||||
{
|
||||
FILE_PLAN_ALIAS("-filePlan-"),
|
||||
TRANSFERS_ALIAS("-transfers-"),
|
||||
UNFILED_RECORDS_CONTAINER_ALIAS("-unfiled-"),
|
||||
HOLDS_ALIAS("-holds-");
|
||||
|
||||
private String alias;
|
||||
|
||||
private FilePlanComponentAlias(String alias)
|
||||
{
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
public static final FilePlanComponentAlias getFilePlanComponentAlias(String alias)
|
||||
{
|
||||
mandatoryString("alias", alias);
|
||||
|
||||
FilePlanComponentAlias result = null;
|
||||
FilePlanComponentAlias[] values = values();
|
||||
|
||||
for (FilePlanComponentAlias filePlanComponentAlias : values)
|
||||
{
|
||||
if (filePlanComponentAlias.toString().equals(alias))
|
||||
{
|
||||
result = filePlanComponentAlias;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
throw new IllegalArgumentException("Invalid file plan component alias enum value: '" + alias + "'.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Enum#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.alias;
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.model.fileplancomponents;
|
||||
|
||||
/**
|
||||
* POJO for file plan component created by object
|
||||
*
|
||||
* @author Kristijan Conkas
|
||||
* @since 1.0
|
||||
*/
|
||||
public class FilePlanComponentCreatedByUser
|
||||
{
|
||||
private String id;
|
||||
private String displayName;
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the displayName
|
||||
*/
|
||||
public String getDisplayName()
|
||||
{
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param displayName the displayName to set
|
||||
*/
|
||||
public void setDisplayName(String displayName)
|
||||
{
|
||||
this.displayName = displayName;
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.model.fileplancomponents;
|
||||
|
||||
import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.ENTRY;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import org.alfresco.rest.core.RestModels;
|
||||
|
||||
/**
|
||||
* POJO for file plan component entry
|
||||
*
|
||||
* @author Tuna Aksoy
|
||||
* @since 1.0
|
||||
*/
|
||||
public class FilePlanComponentEntry extends RestModels<FilePlanComponent, FilePlanComponentEntry>
|
||||
{
|
||||
@JsonProperty(ENTRY)
|
||||
FilePlanComponent filePlanComponent;
|
||||
|
||||
public FilePlanComponent getFilePlanComponent()
|
||||
{
|
||||
return filePlanComponent;
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.model.fileplancomponents;
|
||||
|
||||
/**
|
||||
* File plan component field names constants
|
||||
*
|
||||
* @author Tuna Aksoy
|
||||
* @since 1.0
|
||||
*/
|
||||
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";
|
||||
public static final String PROPERTIES_TITLE = "cm:title";
|
||||
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 ALLOWABLE_OPERATIONS = "allowableOperations";
|
||||
}
|
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.model.fileplancomponents;
|
||||
|
||||
import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
|
||||
import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_HOLD_REASON;
|
||||
import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
|
||||
import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* POJO for file plan component properties
|
||||
*
|
||||
* @author Kristijan Conkas
|
||||
* @since 1.0
|
||||
*/
|
||||
//FIXME: Once the fields have been added the JsonIgnoreProperties annotation should be removed
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class FilePlanComponentProperties
|
||||
{
|
||||
@JsonProperty(PROPERTIES_VITAL_RECORD_INDICATOR)
|
||||
private boolean vitalRecord;
|
||||
|
||||
@JsonProperty(PROPERTIES_TITLE)
|
||||
private String title;
|
||||
|
||||
@JsonProperty(PROPERTIES_HOLD_REASON)
|
||||
private String holdReason;
|
||||
|
||||
@JsonProperty(PROPERTIES_DESCRIPTION)
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* @return the vitalRecord
|
||||
*/
|
||||
public boolean isVitalRecord()
|
||||
{
|
||||
return this.vitalRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vitalRecord the vitalRecord to set
|
||||
*/
|
||||
public void setVitalRecord(boolean vitalRecord)
|
||||
{
|
||||
this.vitalRecord = vitalRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle()
|
||||
{
|
||||
return this.title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title the title to set
|
||||
*/
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the holdReason
|
||||
*/
|
||||
public String getHoldReason()
|
||||
{
|
||||
return this.holdReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param holdReason the holdReason to set
|
||||
*/
|
||||
public void setHoldReason(String holdReason)
|
||||
{
|
||||
this.holdReason = holdReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description the description to set
|
||||
*/
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.model.fileplancomponents;
|
||||
|
||||
import static org.alfresco.rest.util.ParameterCheck.mandatoryString;
|
||||
|
||||
/**
|
||||
* File plan component type enumeration
|
||||
*
|
||||
* @author Tuna Aksoy
|
||||
* @since 1.0
|
||||
*/
|
||||
public enum FilePlanComponentType
|
||||
{
|
||||
FILE_PLAN_TYPE("rma:filePlan"),
|
||||
RECORD_CATEGORY_TYPE("rma:recordCategory"),
|
||||
RECORD_FOLDER_TYPE("rma:recordFolder"),
|
||||
HOLD_TYPE("rma:hold"),
|
||||
UNFILED_RECORD_FOLDER_TYPE("rma:unfiledRecordFolder"),
|
||||
HOLD_CONTAINER_TYPE("rma:holdContainer"),
|
||||
TRANSFER_CONTAINER_TYPE("rma:transferContainer"),
|
||||
UNFILED_CONTAINER_TYPE("rma:unfiledRecordContainer");
|
||||
|
||||
private String type;
|
||||
|
||||
private FilePlanComponentType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public static final FilePlanComponentType getFilePlanComponentType(String type)
|
||||
{
|
||||
mandatoryString("type", type);
|
||||
|
||||
FilePlanComponentType result = null;
|
||||
FilePlanComponentType[] values = values();
|
||||
|
||||
for (FilePlanComponentType filePlanComponentType : values)
|
||||
{
|
||||
if (filePlanComponentType.toString().equals(filePlanComponentType))
|
||||
{
|
||||
result = filePlanComponentType;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
throw new IllegalArgumentException("Invalid file plan component type enum value: '" + type + "'.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Enum#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.type;
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.model.fileplancomponents;
|
||||
|
||||
import org.alfresco.rest.core.RestModels;
|
||||
|
||||
/**
|
||||
* Handle collection of FilePlanComponents
|
||||
*
|
||||
* @author Kristijan Conkas
|
||||
* @since 1.0
|
||||
*/
|
||||
public class FilePlanComponentsCollection extends RestModels<FilePlanComponentEntry, FilePlanComponentsCollection>
|
||||
{
|
||||
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.model.site;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import org.alfresco.rest.model.RestSiteModel;
|
||||
|
||||
/**
|
||||
* POJO for RM Site component
|
||||
*
|
||||
* @author Rodica Sutu
|
||||
* @since 1.0
|
||||
*/
|
||||
public class RMSite extends RestSiteModel
|
||||
{
|
||||
@JsonProperty (required = true)
|
||||
private RMSiteCompliance compliance;
|
||||
|
||||
/**
|
||||
* Helper method to set RM site compliance
|
||||
*
|
||||
* @param compliance {@link RMSiteCompliance} the compliance to set
|
||||
*/
|
||||
public void setCompliance(RMSiteCompliance compliance)
|
||||
{
|
||||
this.compliance = compliance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to get RM site compliance
|
||||
*
|
||||
* @return compliance the RM Site compliance to get
|
||||
*/
|
||||
public RMSiteCompliance getCompliance()
|
||||
{
|
||||
return compliance;
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.model.site;
|
||||
|
||||
/**
|
||||
* RM Site compliance
|
||||
*
|
||||
* @author Tuna Aksoy
|
||||
* @since 1.0
|
||||
*/
|
||||
public enum RMSiteCompliance
|
||||
{
|
||||
STANDARD,
|
||||
DOD5015
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.model.site;
|
||||
|
||||
/**
|
||||
*RM Site properties from the RM Model Schema
|
||||
*"entry": {
|
||||
* "id": "string",
|
||||
* "guid": "string",
|
||||
* "title": "string",
|
||||
* "description": "string",
|
||||
* "visibility": "{@link org.springframework.social.alfresco.api.entities.Site.Visibility}",
|
||||
* "compliance": "{@link RMSiteCompliance}",
|
||||
* "role": "{@link org.alfresco.utility.constants.UserRole}"
|
||||
*}
|
||||
* @author Tuna Aksoy
|
||||
* @author Rodica Sutu
|
||||
* @since 1.0
|
||||
*/
|
||||
public class RMSiteFields
|
||||
{
|
||||
public static final String ID = "id";
|
||||
public static final String COMPLIANCE = "compliance";
|
||||
public static final String TITLE = "title";
|
||||
public static final String DESCRIPTION = "description";
|
||||
public static final String VISIBILITY ="visibility";
|
||||
public static final String ROLE = "role";
|
||||
}
|
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.requests;
|
||||
|
||||
import static org.alfresco.rest.core.RestRequest.requestWithBody;
|
||||
import static org.alfresco.rest.core.RestRequest.simpleRequest;
|
||||
import static org.alfresco.rest.util.ParameterCheck.mandatoryObject;
|
||||
import static org.alfresco.rest.util.ParameterCheck.mandatoryString;
|
||||
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.google.gson.JsonObject;
|
||||
|
||||
import org.alfresco.rest.core.RestAPI;
|
||||
import org.alfresco.rest.model.fileplancomponents.FilePlanComponent;
|
||||
import org.alfresco.rest.model.fileplancomponents.FilePlanComponentsCollection;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* File plan component REST API Wrapper
|
||||
*
|
||||
* @author Tuna Aksoy
|
||||
* @author Kristijan Conkas
|
||||
* @since 1.0
|
||||
*/
|
||||
@Component
|
||||
@Scope(value = "prototype")
|
||||
public class FilePlanComponentAPI extends RestAPI<FilePlanComponentAPI>
|
||||
{
|
||||
/**
|
||||
* 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 usingRestWrapper().processModel(FilePlanComponent.class, simpleRequest(
|
||||
GET,
|
||||
"fileplan-components/{fileplanComponentId}?{parameters}",
|
||||
filePlanComponentId, getParameters()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 usingRestWrapper().processModels(FilePlanComponentsCollection.class, simpleRequest(
|
||||
GET,
|
||||
"fileplan-components/{fileplanComponentId}/children",
|
||||
filePlanComponentId
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a file plan component with the given properties under the parent node with the given id
|
||||
*
|
||||
* @param filePlanComponentProperties 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(JsonObject filePlanComponentProperties, String parentId) throws Exception
|
||||
{
|
||||
mandatoryObject("filePlanComponentProperties", filePlanComponentProperties);
|
||||
mandatoryString("parentId", parentId);
|
||||
|
||||
return usingRestWrapper().processModel(FilePlanComponent.class, requestWithBody(
|
||||
POST,
|
||||
filePlanComponentProperties.toString(),
|
||||
"fileplan-components/{fileplanComponentId}/children",
|
||||
parentId
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a file plan component
|
||||
*
|
||||
* @param filePlanComponentProperties 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(JsonObject filePlanComponentProperties, String filePlanComponentId) throws Exception
|
||||
{
|
||||
mandatoryObject("filePlanComponentProperties", filePlanComponentProperties);
|
||||
mandatoryString("filePlanComponentId", filePlanComponentId);
|
||||
|
||||
return usingRestWrapper().processModel(FilePlanComponent.class, requestWithBody(
|
||||
PUT,
|
||||
filePlanComponentProperties.toString(),
|
||||
"fileplan-components/{fileplanComponentId}",
|
||||
filePlanComponentId
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete file plan component
|
||||
*
|
||||
* @param filePlanComponentId The id of the file plan component to be deleted
|
||||
* @throws Exception for the following cases:
|
||||
* <ul>
|
||||
* <li>{@code fileplanComponentId} is not a valid format</li>
|
||||
* <li>authentication fails</li>
|
||||
* <li>current user does not have permission to delete {@code fileplanComponentId}</li>
|
||||
* <li>{@code fileplanComponentId} does not exist</li>
|
||||
* <li>{@code fileplanComponentId} is locked and cannot be deleted</li>
|
||||
* </ul>
|
||||
*/
|
||||
public void deleteFilePlanComponent(String filePlanComponentId) throws Exception
|
||||
{
|
||||
mandatoryString("filePlanComponentId", filePlanComponentId);
|
||||
|
||||
usingRestWrapper().processEmptyModel(simpleRequest(
|
||||
DELETE,
|
||||
"fileplan-components/{fileplanComponentId}",
|
||||
filePlanComponentId
|
||||
));
|
||||
}
|
||||
}
|
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.requests;
|
||||
|
||||
import static org.alfresco.rest.core.RestRequest.requestWithBody;
|
||||
import static org.alfresco.rest.core.RestRequest.simpleRequest;
|
||||
import static org.alfresco.rest.util.ParameterCheck.mandatoryObject;
|
||||
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.google.gson.JsonObject;
|
||||
|
||||
import org.alfresco.rest.core.RestAPI;
|
||||
import org.alfresco.rest.model.site.RMSite;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* File plan component REST API Wrapper
|
||||
*
|
||||
* @author Tuna Aksoy
|
||||
* @author Rodica Sutu
|
||||
* @since 1.0
|
||||
*/
|
||||
@Component
|
||||
@Scope (value = "prototype")
|
||||
public class RMSiteAPI extends RestAPI<RMSiteAPI>
|
||||
{
|
||||
/**
|
||||
* Get the RM site
|
||||
*
|
||||
* @return The {@link RMSite} for the given file plan component id
|
||||
* @throws Exception for the following cases:
|
||||
* <ul>
|
||||
* <li>Api Response code 400 Invalid parameter: GET request is supported only for the RM site</li>
|
||||
* <li>Api Response code 401 If authentication failed</li>
|
||||
* <li>Api Response code 409 If RM Site does not exist</li>
|
||||
* <li>Api Response code default Unexpected error</li>
|
||||
* </ul>
|
||||
*/
|
||||
public RMSite getSite() throws Exception
|
||||
{
|
||||
return usingRestWrapper().processModel(RMSite.class, simpleRequest(
|
||||
GET,
|
||||
"sites/rm"
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the RM site
|
||||
*
|
||||
* @param rmSiteProperties The properties of the rm site to be created
|
||||
* @return The {@link RMSite} with the given properties
|
||||
* @throws Exception for the following cases:
|
||||
* <ul>
|
||||
* <li>Api Response code 400 Invalid parameter: title, or description exceed the maximum length; or siteBodyCreate invalid</li>
|
||||
* <li>Api Response code 401 If authentication failed</
|
||||
* <li>Api Response code 409 RM Site already exists</li>
|
||||
* <li>Api Response code default Unexpected error</li>
|
||||
* </ul>
|
||||
*/
|
||||
public RMSite createRMSite(JsonObject rmSiteProperties) throws Exception
|
||||
{
|
||||
mandatoryObject("rmSiteProperties", rmSiteProperties);
|
||||
|
||||
return usingRestWrapper().processModel(RMSite.class, requestWithBody(
|
||||
POST,
|
||||
rmSiteProperties.toString(),
|
||||
"sites"
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete RM site
|
||||
* @throws Exception for the following cases:
|
||||
* <ul>
|
||||
* <li>Api Response code 400 Invalid parameter: DELETE request is supported only for the RM site</li>
|
||||
* <li>Api Response code 401 If authentication failed</
|
||||
* <li>Api Response code 403 Current user does not have permission to delete the site that is visible to them.</li>
|
||||
* <li>Api Response code 404 RM site does not exist</li>
|
||||
* <li>Api Response code default Unexpected error</li>
|
||||
* </ul>
|
||||
*/
|
||||
public void deleteRMSite() throws Exception
|
||||
{
|
||||
usingRestWrapper().processEmptyModel(simpleRequest(
|
||||
DELETE,
|
||||
"sites/rm"
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update RM site
|
||||
*
|
||||
* @param rmSiteProperties The properties to be updated
|
||||
* @return The updated {@link RMSite}
|
||||
* @throws Exception for the following cases:
|
||||
* <ul>
|
||||
* <li>Api Response code 400 the update request is invalid {@code rmSiteProperties} is invalid</li>
|
||||
* <li>Api Response code 401 If authentication fails</li>
|
||||
* <li>Api Response code 403 does not have permission to update {@code RMSite}</li>
|
||||
* <li>Api Response code 404 {@code RMSite} does not exist</li>
|
||||
* <li>Api Response code default Unexpected error,model integrity exception</li>
|
||||
* </ul>
|
||||
*/
|
||||
public RMSite updateRMSite(JsonObject rmSiteProperties) throws Exception
|
||||
{
|
||||
mandatoryObject("rmSiteProperties", rmSiteProperties);
|
||||
|
||||
return usingRestWrapper().processModel(RMSite.class, requestWithBody(
|
||||
PUT,
|
||||
rmSiteProperties.toString(),
|
||||
"sites/rm"
|
||||
));
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.util;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
|
||||
/**
|
||||
* Utility class for checking parameters
|
||||
*
|
||||
* @author Tuna Aksoy
|
||||
* @since 1.0
|
||||
*/
|
||||
public class ParameterCheck
|
||||
{
|
||||
private ParameterCheck()
|
||||
{
|
||||
// Intentionally blank
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a given {@link String} is blank or not, i.e. not <code>null<code>, "" or " ".
|
||||
*
|
||||
* @param paramName The name of the parameter to check
|
||||
* @param paramValue The value of the parameter to check
|
||||
* @throws IllegalArgumentException Throws an exception if the given value is blank
|
||||
*/
|
||||
public static void mandatoryString(final String paramName, final String paramValue) throws IllegalArgumentException
|
||||
{
|
||||
if (isBlank(paramValue))
|
||||
{
|
||||
throw new IllegalArgumentException("'" + paramName + "' is a mandatory parameter.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a given {@link Object} is null or not
|
||||
*
|
||||
* @param paramName The name of the parameter to check
|
||||
* @param object The value of the parameter to check
|
||||
* @throws IllegalArgumentException Throws an exception if the given value is null
|
||||
*/
|
||||
public static void mandatoryObject(final String paramName, final Object object) throws IllegalArgumentException
|
||||
{
|
||||
if (object == null)
|
||||
{
|
||||
throw new IllegalArgumentException("'" + paramName + "' is a mandatory parameter.");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user