为什么我的 xpage 看不到另一个数据库中的视图? [英] Why can't my xpage see the views in another database?

查看:35
本文介绍了为什么我的 xpage 看不到另一个数据库中的视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(这是用于 Web 浏览器的 XPage 应用程序)我为来自另一个数据库的视图创建了一个视图面板.该视图显示为空,即使我使用 Notes 客户端可以清楚地看到其中的大约 15 个文档.这是查看源...

(This is XPages app for a web browser) I created a view panel for a view from another database. The view showed up empty, even though I can clearly see about 15 documents in it using the Notes client. Here is the view source...

        <xp:viewPanel rows="30" id="viewPanel3">
            <xp:this.facets>
                <xp:pager partialRefresh="true"
                    layout="Previous Group Next" xp:key="headerPager" id="pager2">
                </xp:pager>
            </xp:this.facets>
            <xp:this.data>
                <xp:dominoView var="view3"
                    databaseName="test\Customer\part.nsf"
                    viewName="LkpMscParts-55EQUIPMENT">
                </xp:dominoView>
            </xp:this.data>

我验证了 ACL,刷新了视图索引,甚至对数据库进行了修复.该页面仍然不会显示文档.(没有读者字段,顺便说一句)

I verified the ACL, refreshed the view index, even ran fixup on the database. The page still won't show the documents. (No readers fields, btw)

所以,然后我添加了一个计算域来显示发生了什么.

So, then I added a computed field to show me what's going on.

var filepath = database.getFilePath();
var partfile = filepath.toLowerCase().replace("ereq_main","part");
var partdb = session.getDatabase(database.getServer(),partfile,false);

print("partdb views total = "+partdb.getViews().length)
for(x=0;x<partdb.getViews.length;x++){
    print("v name = "+partdb.getViews[x].getName());
}
print("partdb server = "+partdb.getServer());
print("partdb title = "+partdb.getTitle())

var vname = "LkpMscParts-55EQUIPMENT";
sessionScope.PartViewName = vname;
var pview = partdb.getView(vname);
if(pview==null){
    sessionScope.PartViewError = "Nothing for LkpMscParts-55EQUIPMENT.";
    print("pview is null")
    return null;
}

var vecol = pview.getAllEntries();
print("partdb = "+partdb.getFilePath());
print("pview = "+pview.getName());
print("pview lines = "+pview.getRowLines());
print("vecol count = "+vecol.getCount())
return vname;

我在控制台上得到了这个:

I get this on the console:

11/18/2017 08:10:48 PM  HTTP JVM: partdb views total = 0
11/18/2017 08:10:48 PM  HTTP JVM: partdb server = CN=domsvr3/O=abc
11/18/2017 08:10:48 PM  HTTP JVM: partdb title = Inventory Parts
11/18/2017 08:10:48 PM  HTTP JVM: partdb = test\Customer\part.nsf
11/18/2017 08:10:48 PM  HTTP JVM: pview = 

然后崩溃

Script interpreter error, line=27, col=46: [TypeError] Exception occurred calling method NotesView.getRowLines() Notes error: Invalid or nonexistent document (LkpMscParts-55EQUIPMENT)
Notes error: Invalid or nonexistent document (LkpMscParts-55EQUIPMENT)

请注意,views 数组的长度是 0 - 什么给出了?数据库中可能有 200 次查看.数据库服务器正确,标题正确,路径正确.因此,它似乎可以看到正确的数据库.但是,然后视图名称出现空白.所以, pview 不为空(因为我检查过)但它是空的.我不明白.这么简单的事情让我发疯.

Notice the length of the views array is 0 - what gives? There's probably 200 views in the db. The database server is correct, the title is correct and the path is correct. So, it appears like it can see the correct database. But, then the view name comes out blank. So, pview isn't null (cuz I checked for that) but yet it's empty. I don't get it. Such a simple thing is driving me nuts.

仅供参考,我现在使用 xpages 已经大约 5 年了,所以我确定我错过了一些简单的东西,但我不能只见树木不见森林".有人可以指出我正确的方向吗?

Just fyi, I've been working with xpages now for about 5 years, so I'm sure I'm missing something simple, but I just can't 'see the forest for the trees'. Can someone please point me in the right direction?

推荐答案

您是否在应用程序代码的其他位置获取该数据库?如果是这样,您是否在该数据库对象上调用 .recycle() ?

Do you get that database elsewhere in code in the application? If so, are you calling .recycle() on that Database object?

我在迁移到 Java 的早期学到的一件事是,如果您回收数据库的句柄,返回原始值(例如字符串)的 getter 仍将返回该值.大概它被缓存了.所以 getTitle()getFilePath() 仍然会返回一个值,但任何更复杂的东西都将不起作用.自从我这样做已经很多年了,但我认为它确实没有任何回报.

One of the things I learned early in moving to Java is that if you recycle a handle to a Database, getters that return primitive values (e.g. Strings) will still return the value. Presumably it gets cached. So getTitle() and getFilePath() will still return a value, but anything getting something more complex will not work. It's a number of years since I did that, but I think it does just return nothing.

在极少数情况下我仍然需要回收(我几乎所有项目都使用 ODA),我只循环回收.每个会话的最大句柄如此之高,对于循环外的 Domino 对象数量而言,没有恐慌:查找句柄超出范围"的风险.

On the rare occasion I still have to recycle (I use ODA for virtually all projects), I only recycle in loops. The maximum handles per session is so high there's no risk of "PANIC: Lookup handles out of range" for the number of Domino objects outside of loops.

这篇关于为什么我的 xpage 看不到另一个数据库中的视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆