Query auditing history and application instructions

Source: Internet
Author: User
Tags dateformat

In the simple configuration and description of filenet auditing, we have introduced the functions of auditing and its statistical functions. It can be said that it is of great value for evaluating the utilization of a document product. Companies that purchased filenet products earlier (such as Zhy) will directly perform custom development on XT, enable the document report statistics function.

The entire report statistics process is actually a query of auditing history, which maps to the query of Event Logs. Just like we query the document type (or custom document type), we use the same method. After understanding the query syntax, you can easily perform related operations. The sample code is as follows.

public long getAuditingInfos(ObjectStore os,Date startDate,Date endDate,Id auditingType,Boolean needParentClassType,String topParentClass,) throws Exception{long total = 0;AuditingInfoBean bean = null;RepositoryRowSet rrs = null;RepositoryRow rr = null;if(startDate != null && endDate != null && (rrs = buildData(os,startDate,endDate,auditingType)) != null){PageIterator iter = rrs.pageIterator();while (iter.nextPage()){    Object[] currentPage = iter.getCurrentPage();    if(currentPage != null){    for(int i=0;i<currentPage.length;i++){    rr = (RepositoryRow)currentPage[i];        if(null != rr && rr.getProperties().getInteger32Value(PropertyNames.EVENT_STATUS) == 0){        try{    rr.getProperties().getIdValue(PropertyNames.ID).toString();    rr.getProperties().getObjectValue(PropertyNames.CREATOR);    rr.getProperties().getIdValue(PropertyNames.SOURCE_OBJECT_ID);    Id classId = rr.getProperties().getIdValue(PropertyNames.SOURCE_CLASS_ID);    PropertyFilter filter = new PropertyFilter();FilterElement ele0 = new FilterElement(null, null, null, PropertyNames.SYMBOLIC_NAME, null);FilterElement ele1 = new FilterElement(null, null, null, PropertyNames.SUPERCLASS_DESCRIPTION, null);filter.addIncludeProperty(ele0);filter.addIncludeProperty(ele1);ClassDescription classDescription = Factory.ClassDescription.fetchInstance(os, classId, filter);String selfSymbolicName = classDescription.get_SymbolicName();        }catch(Exception e){    logger.error(e.toString());    continue;    }    }    }    }}}return total;}private RepositoryRowSet buildData(ObjectStore os,Date startDate,Date endDate,Id auditingType){RepositoryRowSet rrs  = null;if(AuditingUtil.CREATIONEVENT == auditingType || AuditingUtil.GETCONTENTEVENT == auditingType){String sqlString = "SELECT "  + PropertyNames.CREATOR + "," + PropertyNames.ID + "," + PropertyNames.DATE_CREATED + "," + PropertyNames.EVENT_STATUS + "," + PropertyNames.SOURCE_CLASS_ID + "," + PropertyNames.SOURCE_OBJECT_ID;SearchSQL searchSql = new SearchSQL(sqlString + " FROM " + auditingType +         " WHERE " +         PropertyNames.DATE_CREATED + " >= " + dateFormat(startDate) +         " AND " +         PropertyNames.DATE_CREATED  + " < " + dateFormat(endDate) +        " ORDER BY " + PropertyNames.DATE_CREATED);SearchScope ss = new SearchScope(os);PropertyFilter filter = new PropertyFilter();FilterElement ele1 = new FilterElement(null, null, null, PropertyNames.EVENT_STATUS, null);FilterElement ele2 = new FilterElement(null, null, null, PropertyNames.CREATOR, null);FilterElement ele3 = new FilterElement(null, null, null, PropertyNames.DATE_CREATED, null);FilterElement ele4 = new FilterElement(null, null, null, PropertyNames.SOURCE_CLASS_ID, null);FilterElement ele5 = new FilterElement(null, null, null, PropertyNames.SOURCE_OBJECT_ID, null);filter.addIncludeProperty(ele1);filter.addIncludeProperty(ele2);filter.addIncludeProperty(ele3);filter.addIncludeProperty(ele4);filter.addIncludeProperty(ele5);rrs = ss.fetchRows(searchSql, 1000, filter, true);}return rrs;}private String dateFormat(Date date){SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");String dateStr = sdf.format(date);sdf = new SimpleDateFormat("HHmmss");dateStr = dateStr + "T" + sdf.format(date) + "Z";return dateStr;}

Filenet provides a process analyzer, but does not provide products that work with auditing. Although this work of direct customization development can be implemented in functions, however, the efficiency problem is that the function that has been customized on XT has also become useless with the quantity of hundreds of thousands of attachments in a Zhy branch. The reason is not that filenet storage is not optimized enough, but auditing stores the content related to the corresponding operation events. Although the operating document instances are also stored, however, it takes a lot of time to obtain the document information (such as the name or department where the operator is located.

To address such problems, you can directly clarify the filenet database and then directly operate the database. However, this risk is high and the product upgrade may be inconvenient; in addition, you can consider transferring business-related data to the application's business database in a scheduled task. This kind of short-term auditing query can be easily accepted when the application is idle, although there is a certain delay in this method, the statistics itself have a large amount of time, which is acceptable for a delay of one or shorter time. Of course, we can still completely ignore auditing, record the relevant statistics directly in the business, but in addition to more development work, it is more important for the existing products (or applications) the changes will be very large, and may lead to a greater workload (such as testing) than such development ). Therefore, you can select either of the following two options in the project phase. If you are a filenet internal employee, you may prefer the first option, but you need to consider the upgrade risk.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.