Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Latest commit

 

History

History
529 lines (369 loc) · 13.1 KB

ModelsApi.md

File metadata and controls

529 lines (369 loc) · 13.1 KB

ModelsApi

All URIs are relative to /activiti-app/api

Method HTTP request Description
createModel POST /enterprise/models Create a new model
deleteModel DELETE /enterprise/models/{modelId} Delete a model
duplicateModel POST /enterprise/models/{modelId}/clone Duplicate an existing model
getModelJSON GET /enterprise/models/{modelId}/editor/json Get model content
getModelThumbnail GET /enterprise/models/{modelId}/thumbnail Get a model's thumbnail image
getModel GET /enterprise/models/{modelId} Get a model
getModelsToIncludeInAppDefinition GET /enterprise/models-for-app-definition List process definition models shared with the current user
getModels GET /enterprise/models List models (process, form, decision rule or app)
importNewVersion POST /enterprise/models/{modelId}/newversion Create a new version of a model
importProcessModel POST /enterprise/process-models/import Import a BPMN 2.0 XML file
saveModel POST /enterprise/models/{modelId}/editor/json Update model content
updateModel PUT /enterprise/models/{modelId} Update a model
validateModel POST /enterprise/models/{modelId}/editor/validate Validate model content

createModel

ModelRepresentation createModel(modelRepresentation)

Create a new model

Example

import ModelsApi from 'ModelsApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let modelsApi = new ModelsApi(this.alfrescoApi);


modelsApi.createModel(modelRepresentation).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
modelRepresentation ModelRepresentation modelRepresentation

Return type

ModelRepresentation

deleteModel

deleteModel(modelIdopts)

Delete a model

Example

import ModelsApi from 'ModelsApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let modelsApi = new ModelsApi(this.alfrescoApi);

let opts = { 
  'cascade': true //  | cascade
  'deleteRuntimeApp': true //  | deleteRuntimeApp
};

modelsApi.deleteModel(modelIdopts).then(() => {
  console.log('API called successfully.');
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
modelId number modelId
cascade boolean cascade [optional]
deleteRuntimeApp boolean deleteRuntimeApp [optional]

Return type

null (empty response body)

duplicateModel

ModelRepresentation duplicateModel(modelIdmodelRepresentation)

Duplicate an existing model

Example

import ModelsApi from 'ModelsApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let modelsApi = new ModelsApi(this.alfrescoApi);


modelsApi.duplicateModel(modelIdmodelRepresentation).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
modelId number modelId
modelRepresentation ModelRepresentation modelRepresentation

Return type

ModelRepresentation

getModelJSON

ObjectNode getModelJSON(modelId)

Get model content

Example

import ModelsApi from 'ModelsApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let modelsApi = new ModelsApi(this.alfrescoApi);


modelsApi.getModelJSON(modelId).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
modelId number modelId

Return type

ObjectNode

getModelThumbnail

string getModelThumbnail(modelId)

Get a model's thumbnail image

Example

import ModelsApi from 'ModelsApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let modelsApi = new ModelsApi(this.alfrescoApi);


modelsApi.getModelThumbnail(modelId).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
modelId number modelId

Return type

string

getModel

ModelRepresentation getModel(modelIdopts)

Get a model

Models act as containers for process, form, decision table and app definitions

Example

import ModelsApi from 'ModelsApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let modelsApi = new ModelsApi(this.alfrescoApi);

let opts = { 
  'includePermissions': true //  | includePermissions
};

modelsApi.getModel(modelIdopts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
modelId number modelId
includePermissions boolean includePermissions [optional]

Return type

ModelRepresentation

getModelsToIncludeInAppDefinition

ResultListDataRepresentationModelRepresentation getModelsToIncludeInAppDefinition()

List process definition models shared with the current user

Example

import ModelsApi from 'ModelsApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let modelsApi = new ModelsApi(this.alfrescoApi);

modelsApi.getModelsToIncludeInAppDefinition().then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

This endpoint does not need any parameter.

Return type

ResultListDataRepresentationModelRepresentation

getModels

ResultListDataRepresentationModelRepresentation getModels(opts)

List models (process, form, decision rule or app)

Example

import ModelsApi from 'ModelsApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let modelsApi = new ModelsApi(this.alfrescoApi);

let opts = { 
  'filter': filter_example //  | filter
  'sort': sort_example //  | sort
  'modelType': 56 //  | modelType
  'referenceId': 789 //  | referenceId
};

modelsApi.getModels(opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
filter string filter [optional]
sort string sort [optional]
modelType number modelType [optional]
referenceId number referenceId [optional]

Return type

ResultListDataRepresentationModelRepresentation

importNewVersion

ModelRepresentation importNewVersion(modelIdfile)

Create a new version of a model

Example

import ModelsApi from 'ModelsApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let modelsApi = new ModelsApi(this.alfrescoApi);


modelsApi.importNewVersion(modelIdfile).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
modelId number modelId
file Blob file

Return type

ModelRepresentation

importProcessModel

ModelRepresentation importProcessModel(file)

Import a BPMN 2.0 XML file

Example

import ModelsApi from 'ModelsApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let modelsApi = new ModelsApi(this.alfrescoApi);


modelsApi.importProcessModel(file).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
file Blob file

Return type

ModelRepresentation

saveModel

ModelRepresentation saveModel(modelIdvalues)

Update model content

Example

import ModelsApi from 'ModelsApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let modelsApi = new ModelsApi(this.alfrescoApi);


modelsApi.saveModel(modelIdvalues).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
modelId number modelId
values any values

Return type

ModelRepresentation

updateModel

ModelRepresentation updateModel(modelIdupdatedModel)

Update a model

This method allows you to update the metadata of a model. In order to update the content of the model you will need to call the specific endpoint for that model type.

Example

import ModelsApi from 'ModelsApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let modelsApi = new ModelsApi(this.alfrescoApi);


modelsApi.updateModel(modelIdupdatedModel).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
modelId number modelId
updatedModel ModelRepresentation updatedModel

Return type

ModelRepresentation

validateModel

ValidationErrorRepresentation validateModel(modelIdopts)

Validate model content

Example

import ModelsApi from 'ModelsApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let modelsApi = new ModelsApi(this.alfrescoApi);

let opts = { 
  'values':  //  | values
};

modelsApi.validateModel(modelIdopts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
modelId number modelId
values any values [optional]

Return type

ValidationErrorRepresentation