New packages org (#2639)

New packages org
This commit is contained in:
Eugenio Romano
2017-11-16 14:12:52 +00:00
committed by GitHub
parent 6a24c6ef75
commit a52bb5600a
1984 changed files with 17179 additions and 40423 deletions

View File

@@ -0,0 +1,55 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
* This object represent the basic structure of a card view.
*
*
* @returns {CardViewBaseItemModel} .
*/
export interface CardViewItemProperties {
label: string;
value: any;
key: any;
default?: string;
editable?: boolean;
clickable?: boolean;
}
export abstract class CardViewBaseItemModel {
label: string;
value: any;
key: any;
default: string;
editable: boolean;
clickable: boolean;
constructor(obj: CardViewItemProperties) {
this.label = obj.label || '';
this.value = obj.value;
this.key = obj.key;
this.default = obj.default;
this.editable = !!obj.editable;
this.clickable = !!obj.clickable;
}
isEmpty(): boolean {
return this.value === undefined || this.value === null || this.value === '';
}
}

View File

@@ -0,0 +1,51 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
* This object represent the basic structure of a card view.
*
*
* @returns {CardViewDateItemModel} .
*/
import * as moment from 'moment';
import { CardViewItem } from '../interface/card-view-item.interface';
import { DynamicComponentModel } from '../services/dynamic-component-mapper.service';
import { CardViewBaseItemModel, CardViewItemProperties } from './card-view-baseitem.model';
export interface CardViewDateItemProperties extends CardViewItemProperties {
format?: string;
}
export class CardViewDateItemModel extends CardViewBaseItemModel implements CardViewItem, DynamicComponentModel {
type: string = 'date';
format: string;
constructor(obj: CardViewDateItemProperties) {
super(obj);
this.format = obj.format || 'MMM DD YYYY';
}
get displayValue() {
if (!this.value) {
return this.default;
} else {
return moment(this.value).format(this.format);
}
}
}

View File

@@ -0,0 +1,45 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
* This object represent the basic structure of a card view.
*
*
* @returns {CardViewMapItemModel} .
*/
import { CardViewItem } from '../interface/card-view-item.interface';
import { DynamicComponentModel } from '../services/dynamic-component-mapper.service';
import { CardViewBaseItemModel, CardViewItemProperties } from './card-view-baseitem.model';
export class CardViewMapItemModel extends CardViewBaseItemModel implements CardViewItem, DynamicComponentModel {
type: string = 'map';
value: Map<string, string>;
constructor(obj: CardViewItemProperties) {
super(obj);
}
get displayValue() {
if (this.value && this.value.size > 0) {
return this.value.values().next().value;
} else {
return this.default;
}
}
}

View File

@@ -0,0 +1,46 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
* This object represent the basic structure of a card view.
*
*
* @returns {CardViewTextItemModel} .
*/
import { CardViewItem } from '../interface/card-view-item.interface';
import { DynamicComponentModel } from '../services/dynamic-component-mapper.service';
import { CardViewBaseItemModel, CardViewItemProperties } from './card-view-baseitem.model';
export interface CardViewTextItemProperties extends CardViewItemProperties {
multiline?: boolean;
}
export class CardViewTextItemModel extends CardViewBaseItemModel implements CardViewItem, DynamicComponentModel {
type: string = 'text';
multiline: boolean;
constructor(obj: CardViewTextItemProperties) {
super(obj);
this.multiline = !!obj.multiline ;
}
get displayValue() {
return this.value;
}
}

View File

@@ -0,0 +1,34 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { CommentRepresentation, LightUserRepresentation } from 'alfresco-js-api';
export class CommentProcessModel implements CommentRepresentation {
id: number;
message: string;
created: Date;
createdBy: LightUserRepresentation;
constructor(obj?: any) {
if (obj) {
this.id = obj.id;
this.message = obj.message;
this.created = obj.created;
this.createdBy = obj.createdBy;
}
}
}

View File

@@ -0,0 +1,28 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export class ComponentTranslationModel {
name: string;
path: string;
json: string [];
constructor(obj?: any) {
this.name = obj && obj.name;
this.path = obj && obj.path;
this.json = obj && obj.json || [];
}
}

View File

@@ -0,0 +1,27 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export class EcmCompanyModel {
organization: string;
address1: string;
address2: string;
address3: string;
postcode: string;
telephone: string;
fax: string;
email: string;
}

View File

@@ -0,0 +1,48 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FileModel } from './file.model';
describe('FileModel', () => {
describe('extension', () => {
it('should return the extension if file has it', () => {
const file = new FileModel(<File> { name: 'tyrion-lannister.doc' });
expect(file.extension).toBe('doc');
});
it('should return the empty string if file has NOT got it', () => {
const file = new FileModel(<File> { name: 'daenerys-targaryen' });
expect(file.extension).toBe('');
});
it('should return the empty string if file is starting with . and doesn\'t have extension', () => {
const file = new FileModel(<File> { name: '.white-walkers' });
expect(file.extension).toBe('');
});
it('should return the last extension string if file contains many dot', () => {
const file = new FileModel(<File> { name: 'you.know.nothing.jon.snow.exe' });
expect(file.extension).toBe('exe');
});
});
});

View File

@@ -0,0 +1,81 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface FileUploadProgress {
loaded: number;
total: number;
percent: number;
}
export interface FileUploadOptions {
newVersion?: boolean;
parentId?: string;
path?: string;
}
export enum FileUploadStatus {
Pending = 0,
Complete = 1,
Starting = 2,
Progress = 3,
Cancelled = 4,
Aborted = 5,
Error = 6,
Deleted = 7
}
export class FileModel {
readonly id: string;
readonly name: string;
readonly size: number;
readonly file: File;
status: FileUploadStatus = FileUploadStatus.Pending;
progress: FileUploadProgress;
options: FileUploadOptions;
data: any;
constructor(file: File, options?: FileUploadOptions) {
this.file = file;
this.id = this.generateId();
this.name = file.name;
this.size = file.size;
this.data = null;
this.progress = {
loaded: 0,
total: 0,
percent: 0
};
this.options = Object.assign({}, {
newVersion: false
}, options);
}
private generateId(): string {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
let r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
get extension(): string {
return this.name.slice((Math.max(0, this.name.lastIndexOf('.')) || Infinity) + 1);
}
}

18
lib/core/models/index.ts Normal file
View File

@@ -0,0 +1,18 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './public-api';

View File

@@ -0,0 +1,34 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export class LogLevelsEnum extends Number {
static TRACE: number = 5;
static DEBUG: number = 4;
static INFO: number = 3;
static WARN: number = 2;
static ERROR: number = 1;
static SILENT: number = 0;
}
export let logLevels: any[] = [
{level: LogLevelsEnum.TRACE, name: 'TRACE'},
{level: LogLevelsEnum.DEBUG, name: 'DEBUG'},
{level: LogLevelsEnum.INFO, name: 'INFO'},
{level: LogLevelsEnum.WARN, name: 'WARN'},
{level: LogLevelsEnum.ERROR, name: 'ERROR'},
{level: LogLevelsEnum.SILENT, name: 'SILENT'}
];

View File

@@ -0,0 +1,27 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export class PermissionsEnum extends String {
static DELETE: string = 'delete';
static UPDATE: string = 'update';
static CREATE: string = 'create';
static UPDATEPERMISSIONS: string = 'updatePermissions';
static NOT_DELETE: string = '!delete';
static NOT_UPDATE: string = '!update';
static NOT_CREATE: string = '!create';
static NOT_UPDATEPERMISSIONS: string = '!updatePermissions';
}

View File

@@ -0,0 +1,141 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export class BpmProductVersionModel {
edition: string;
majorVersion: string;
revisionVersion: string;
minorVersion: string;
type: string;
constructor(obj?: any) {
if (obj) {
this.edition = obj.edition || null;
this.majorVersion = obj.majorVersion || null;
this.revisionVersion = obj.revisionVersion || null;
this.minorVersion = obj.minorVersion || null;
this.type = obj.type || null;
}
}
}
export class EcmProductVersionModel {
edition: string;
version: VersionModel;
license: LicenseModel;
status: VersionStatusModel;
modules: VersionModuleModel[] = [];
constructor(obj?: any) {
if (obj && obj.entry && obj.entry.repository) {
this.edition = obj.entry.repository.edition || null;
this.version = new VersionModel(obj.entry.repository.version);
this.license = new LicenseModel(obj.entry.repository.license);
this.status = new VersionStatusModel(obj.entry.repository.status);
if (obj.entry.repository.modules) {
obj.entry.repository.modules.forEach((module) => {
this.modules.push(new VersionModuleModel(module));
});
}
}
}
}
export class VersionModel {
major: string;
minor: string;
patch: string;
hotfix: string;
schema: number;
label: string;
display: string;
constructor(obj?: any) {
if (obj) {
this.major = obj.major || null;
this.minor = obj.minor || null;
this.patch = obj.patch || null;
this.hotfix = obj.hotfix || null;
this.schema = obj.schema || null;
this.label = obj.label || null;
this.display = obj.display || null;
}
}
}
export class LicenseModel {
issuedAt: string;
expiresAt: string;
remainingDays: number;
holder: string;
mode: string;
isClusterEnabled: boolean;
isCryptodocEnabled: boolean;
constructor(obj?: any) {
if (obj) {
this.issuedAt = obj.issuedAt || null;
this.expiresAt = obj.expiresAt || null;
this.remainingDays = obj.remainingDays || null;
this.holder = obj.holder || null;
this.mode = obj.mode || null;
this.isClusterEnabled = obj.isClusterEnabled ? true : false;
this.isCryptodocEnabled = obj.isCryptodocEnabled ? true : false;
}
}
}
export class VersionStatusModel {
isReadOnly: boolean;
isAuditEnabled: boolean;
isQuickShareEnabled: boolean;
isThumbnailGenerationEnabled: boolean;
constructor(obj?: any) {
if (obj) {
this.isReadOnly = obj.isReadOnly ? true : false;
this.isAuditEnabled = obj.isAuditEnabled ? true : false;
this.isQuickShareEnabled = obj.isQuickShareEnabled ? true : false;
this.isThumbnailGenerationEnabled = obj.isThumbnailGenerationEnabled ? true : false;
}
}
}
export class VersionModuleModel {
id: string;
title: string;
description: string;
version: string;
installDate: string;
installState: string;
versionMin: string;
versionMax: string;
constructor(obj?: any) {
if (obj) {
this.id = obj.id || null;
this.title = obj.title || null;
this.description = obj.description || null;
this.version = obj.version || null;
this.installDate = obj.installDate || null;
this.installState = obj.installState || null;
this.versionMin = obj.versionMin || null;
this.versionMax = obj.versionMax || null;
}
}
}

View File

@@ -0,0 +1,28 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './card-view-baseitem.model';
export * from './card-view-textitem.model';
export * from './card-view-mapitem.model';
export * from './card-view-dateitem.model';
export * from './file.model';
export * from './permissions.enum';
export * from './site.model';
export * from './product-version.model';
export * from './user-process.model';
export * from './comment-process.model';
export * from './ecm-company.model';

View File

@@ -0,0 +1,91 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Pagination } from 'alfresco-js-api';
export class SiteContentsModel {
id: string;
folderId: string;
constructor(obj?: any) {
if (obj) {
this.id = obj.id || null;
this.folderId = obj.folderId || null;
}
}
}
export class SiteMembersModel {
role: string;
firstName: string;
emailNotificationsEnabled: boolean = false;
company: any;
id: string;
enable: boolean = false;
email: string;
constructor(obj?: any) {
if (obj) {
this.role = obj.role;
this.firstName = obj.firstName || null;
this.emailNotificationsEnabled = obj.emailNotificationsEnabled;
this.company = obj.company || null;
this.id = obj.id || null;
this.enable = obj.enable;
this.email = obj.email;
}
}
}
export class SiteModel {
role: string;
visibility: string;
guid: string;
description: string;
id: string;
preset: string;
title: string;
contents: SiteContentsModel[] = [];
members: SiteMembersModel[] = [];
pagination: Pagination;
constructor(obj?: any) {
if (obj && obj.entry) {
this.role = obj.entry.role || null;
this.visibility = obj.entry.visibility || null;
this.guid = obj.entry.guid || null;
this.description = obj.entry.description || null;
this.id = obj.entry.id || null;
this.preset = obj.entry.preset;
this.title = obj.entry.title;
this.pagination = obj.pagination || null;
if (obj.relations && obj.relations.containers) {
obj.relations.containers.list.entries.forEach((content) => {
this.contents.push(new SiteContentsModel(content.entry));
});
}
if (obj.relations && obj.relations.members) {
obj.relations.members.list.entries.forEach((member) => {
this.members.push(new SiteMembersModel(member.entry));
});
}
}
}
}

View File

@@ -0,0 +1,41 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This object represent the process service user.*
*/
import { LightUserRepresentation } from 'alfresco-js-api';
export class UserProcessModel implements LightUserRepresentation {
id?: number;
email?: string;
firstName?: string;
lastName?: string;
pictureId?: number = null;
constructor(obj?: any) {
if (obj) {
this.id = obj.id;
this.email = obj.email || null;
this.firstName = obj.firstName || null;
this.lastName = obj.lastName || null;
this.pictureId = obj.pictureId || null;
}
}
}