首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用alfresco连接到Alfresco?

如何使用alfresco连接到Alfresco?
EN

Stack Overflow用户
提问于 2022-02-10 14:38:16
回答 1查看 185关注 0票数 0

我正在学习本教程:https://www.alfresco.com/abn/adf/docs/tutorials/working-with-data-table/

这是我的mydatatable.component.ts

代码语言:javascript
复制
import { Component, OnInit } from '@angular/core';
import { AlfrescoApiService } from '@alfresco/adf-core';
import { ObjectDataTableAdapter, ObjectDataRow } from '@alfresco/adf-core';

@Component({
  selector: 'app-mydatatable',
  templateUrl: './mydatatable.component.html',
  styleUrls: ['./mydatatable.component.scss']
})
export class MydatatableComponent implements OnInit {

  data = new ObjectDataTableAdapter([],[]);

  
  constructor(private apiService: AlfrescoApiService) {

    let api: any = this.apiService.getInstance();
  //   let api2: any = this.apiService;

  api.webScript.executeWebScript(
    'GET',
    'people',
    [],
    null,
    '/alfresco/api/-default-/public/alfresco/versions/1',
    null
 ).then(
    (response: any) => {
       let results = [];
       for (var entry of response.list.entries) {
          results.push({
             id: entry.entry.id,
             firstName: entry.entry.firstName,
             lastName: entry.entry.lastName,
             status: 'green',
             icon: 'material-icons://accessibility'
          });
       }
       this.data.setRows(results.map(item => {
          return new ObjectDataRow(item);
       }));
    }
 );

}

  ngOnInit(): void {
    
  }

  onRowClick(event: any) {
    alert('We just clicked row id: ' + event.value.obj.status);
  }

}

和mydatatable.component.html

代码语言:javascript
复制
<adf-datatable 


(rowClick)="onRowClick($event)"
  [data]="data">
  <data-columns>
    <data-column 
      key="icon" 
      type="image" 
        [sortable]="false">
      </data-column>
    <data-column 
      key="firstName" 
      title="First Name">
    </data-column>
    <data-column 
      key="lastName" 
      title="Last Name" 
      class="full-width name-column">
    </data-column>
    <data-column key="status" title="Status">
        <ng-template let-entry="$implicit">
          <span *ngIf="entry.data.getValue(entry.row, entry.col) == 'red'" style="background-color: red; width: 20px; height: 20px"></span>
          <span *ngIf="entry.data.getValue(entry.row, entry.col) == 'green'" style="background-color: green; width: 20px; height: 20px"></span>
        </ng-template>
      </data-column>

  </data-columns>
</adf-datatable>

当我编译时,我在http://localhost:4200/mydatatable上什么也得不到。然而,在控制台中,我得到了以下错误:

代码语言:javascript
复制
core.js:4442 ERROR TypeError: Cannot read properties of undefined (reading 'executeWebScript')
    at new MydatatableComponent (mydatatable.component.ts:22)
    at NodeInjectorFactory.MydatatableComponent_Factory [as factory] (mydatatable.component.ts:55)
    at getNodeInjectable (core.js:4274)
    at instantiateRootComponent (core.js:8026)
    at createRootComponent (core.js:13542)
    at ComponentFactory$1.create (core.js:24101)
    at ViewContainerRef.createComponent (core.js:10205)
    at RouterOutlet.activateWith (router.js:5178)
    at RouterOutlet.ngOnInit (router.js:5114)
    at callHook (core.js:3281)

这是我的app.config.json:

代码语言:javascript
复制
{
 "$schema": "../node_modules/@alfresco/adf-core/app.config.schema.json",
 "ecmHost": "{protocol}//{hostname}{:port}",
 "bpmHost": "{protocol}//{hostname}{:port}",
 "providers": "ALL",
 "authType": "BASIC",
 "identityHost": "{protocol}//{hostname}{:port}/auth/realms/alfresco",
 "oauth2": {
   "host": "{protocol}//{hostname}{:port}/auth/realms/alfresco",
   "clientId": "alfresco",
   "scope": "openid",
   "secret": "",
   "implicitFlow": true,
   "silentLogin": true,
   "redirectSilentIframeUri": "{protocol}//{hostname}{:port}/assets/silent-refresh.html",
   "redirectUri": "/",
   "redirectUriLogout": "/logout"
 },
 "application": {
   "name": "GED ADF"
 },
 "languages": [
   {
     "key": "en",
     "label": "English"
   },
   {
     "key": "fr",
     "label": "French"
   },
   {
     "key": "de",
     "label": "German"
   },
   {
     "key": "it",
     "label": "Italian"
   },
   {
     "key": "es",
     "label": "Spanish"
   },
   {
     "key": "ja",
     "label": "Japanese"
   },
   {
     "key": "nl",
     "label": "Dutch"
   },
   {
     "key": "pt-BR",
     "label": "Brazilian Portuguese"
   },
   {
     "key": "nb",
     "label": "Norwegian"
   },
   {
     "key": "ru",
     "label": "Russian"
   },
   {
     "key": "zh-CN",
     "label": "Simplified Chinese"
   }
 ],
 "logLevel": "trace"
}

PS:当我在postman上尝试相同的url时,它可以工作,我使用的是节点v14.17.1和NPM8.3.2

问题是什么,我如何解决?

提前谢谢你

EN

回答 1

Stack Overflow用户

发布于 2022-02-12 10:23:37

您可以使用以下方式:

使用

  1. 的AlfrescoApiService

构造函数(私有this.apiService.getInstance().webScripti.executeWebScript('GET',apiService: AlfrescoApiService) {AlfrescoApiService‘api/任务实例?=’+this.authService.getEcmUsername()‍}

  1. https://www.alfresco.com/abn/adf/docs/core/services/people-content.service/
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71067046

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档