【问题标题】:How to fetch the PropertyTemplate by symbolic name and appended to Custom Object class IBM FileNet CE API如何按符号名称获取 PropertyTemplate 并附加到自定义对象类 IBM FileNet CE API
【发布时间】:2021-11-12 14:46:00
【问题描述】:

如何通过符号名称获取 PropertyTemplate 并通过 IBM FileNet CE API 附加到自定义对象类

【问题讨论】:

    标签: filenet-p8 filenet filenet-content-engine


    【解决方案1】:

    您可以使用以下函数来获取属性模板:

    public PropertyTemplate getPropertyTemplate(String name, ObjectStore objectStore ) 
    {
        String queryFormat = "SELECT [This] FROM [PropertyTemplate] WHERE ([SymbolicName] = ''{0}'')";      
        SearchScope scope = new SearchScope( objectStore );
        String query = MessageFormat.format(queryFormat, name );
        RepositoryRowSet fetchRows = scope.fetchRows(new SearchSQL( query ), null, null, null );
        Iterator<?> iterator = fetchRows.iterator();
        if ( !iterator.hasNext() )
        {
            return null;
        }
    
        RepositoryRow row = (RepositoryRow) iterator.next();
        return (PropertyTemplate) row.getProperties().getObjectValue("This");
    }
    

    然后使用以下代码将属性模板添加到类中:

    
    PropertyTemplate propertyTemplate = getPropertyTemplate(name, objectStore);
    ClassDefinition classDefinition = Factory.ClassDefinition.fetchInstance(objectStore, className, null);
    PropertyDefinition propertyDefinition = propertyTemplate.createClassProperty();
    
    // Set some additional properties on the property definition 
    // to override template defaults
    
    classDefinition.get_PropertyDefinitions().add(propertyDefinition);
    classDefinition.save(RefreshMode.NO_REFRESH);
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多