我是liferay的新手。我正在使用 liferay 6.0.5 我想通过代码将“存档”标签添加到文档库文档中,以便稍后我可以使用“存档”标签获取文档。这个怎么做?
这是正在处理的代码:
private void addArchive(List<DLFileEntry> fileEntryList) {
try
{
long groupId=0;
long userId=0;
String className=null;
long classPK=0;
long categoryIds[]=null;
String tagNames[]=null;
String newTagNames[] = new String[20];
long entryId = 0;
List<AssetTag> TNames = new ArrayList<AssetTag>();
int i = 0;
for(DLFileEntry cur:fileEntryList)
{
groupId=cur.getGroupId();
userId=cur.getUserId();
className=cur.getClass().getName();
classPK=cur.getPrimaryKey();
AssetEntry ae=AssetEntryLocalServiceUtil.getEntry(groupId, cur.getUuid());
categoryIds=ae.getCategoryIds();
entryId = ae.getEntryId();
TNames = ae.getTags();
System.out.println(cur.getTitle());
i=0;
for(AssetTag tag : TNames)
{
System.out.println(tag.getName());
newTagNames[i]=tag.getName().toString();
i++;
}
newTagNames[i]="NameArchive";
AssetEntryLocalServiceUtil.updateEntry(userId, groupId, className, classPK, categoryIds, newTagNames);
System.out.println("------------------------------------------------");
}
System.out.println("outside for loop");
}
catch (Exception e) {
// TODO: handle exception
}
}