Package de.innovationgate.webgate.api

Examples of de.innovationgate.webgate.api.WGUpdateLog


            LogEntry entry;
           
            // First pass: Create update logs
            while (logEntries.hasNext()) {
                entry = (LogEntry) logEntries.next();
                WGUpdateLog newLog = null;
                WGUpdateLog oldLog = null;
                Date currentTime = null;
                if (entry.getTarget() != null && !entry.getTarget().equals("#UNKNOWN#")) {
                    newLog = new WGUpdateLog(entry.getType(), entry.getLogtime(), entry.getLoguser(), entry.getTarget());
                    wgLogs.add(newLog);
                   
                    List logsList = (List) wgLogsByTarget.get(entry.getTarget());
                    if (logsList == null) {
                        logsList = new ArrayList();
                        wgLogsByTarget.put(entry.getTarget(), logsList);
                    }
                    logsList.add(newLog);
                }
            }
           
            // Second pass for CS version < 5 to workaround some weaknesses of the CS3/4 history log
            if (_ddlVersion < WGDatabase.CSVERSION_WGA5) {
               
                // Determine conflicting log entries, where update and delete is done on the same time and the same document
                Iterator wgLogsByTargetIt = wgLogsByTarget.values().iterator();
                while (wgLogsByTargetIt.hasNext()) {
                    List logs = (List) wgLogsByTargetIt.next();
                    WGUtils.sortByProperty(logs, "date");
                    Iterator logsIt = logs.iterator();
                    Date lastTime = null;
                    List<WGUpdateLog> logsAtSameTime = new ArrayList();
                    while (logsIt.hasNext()) {
                        WGUpdateLog log = (WGUpdateLog) logsIt.next();
                        if (log.getDate().equals(lastTime)) {
                            logsAtSameTime.add(log);
                        }
                        else {
                            resolveLogConflicts(wgLogs, logsAtSameTime);               
                            logsAtSameTime.clear();
                        }
                        lastTime = log.getDate();
                    }
                }
               
                // Order logentries that have the same time in an order that assures dependency documents are created before their dependent documents
                Collections.sort(wgLogs, new DocumentDependencyComparator());
View Full Code Here


        // Reverse the sort order so we have the maximum logtimes at the beginning
        Collections.reverse(conflictLogs);
       
        // Get the operations having the maximum logtime
        WGUpdateLog maxUpdateLog = null;
        WGUpdateLog maxDeletionLog = null;
        Iterator logsIt = conflictLogs.iterator();
        Date maxDate = null;
        while (logsIt.hasNext()) {
            WGUpdateLog log = (WGUpdateLog) logsIt.next();
           
            if (maxDate == null) {
                maxDate = log.getDate();
            }
            else if (!maxDate.equals(log.getDate())) {
                break;
            }
           
            if (log.getType() == WGUpdateLog.TYPE_UPDATE) {
                maxUpdateLog = log;
            }
            else if (log.getType() == WGUpdateLog.TYPE_DELETE) {
                maxDeletionLog = log;
            }
        }
       
        // Now lets see what we have - If there is only one type of log we have no problem
View Full Code Here

    private List filterLogs(List updateLogs) {
      
        List newLogs = new ArrayList();
        Iterator logs = updateLogs.iterator();
        while (logs.hasNext()) {
            WGUpdateLog log = (WGUpdateLog) logs.next();
            if (log.getDocumentKey().startsWith("$")) {
                continue;
            }
           
            WGDocumentKey docKey = new WGDocumentKey(log.getDocumentKey());
            if (docKey.getTypename().equals(WGDocument.TYPENAME_TML) ||
                docKey.getTypename().equals(WGDocument.TYPENAME_CSSJS) ||
                docKey.getTypename().equals(WGDocument.TYPENAME_FILECONTAINER)) {
               
                // If lookup variants have changed (and feature is active) we need to change the log to use the base name
                // So the correct caches are cleared
                if (_lookupVariants == true && _slaveDB != null) {
                    String suffix = "." + _slaveDB.getDbReference();
                    if (docKey.getName().endsWith(suffix)) {
                        String newName = DesignProviderCoreWrapper.cutoffVariantSuffix(docKey.getName(), suffix);
                        WGDocumentKey newKey = new WGDocumentKey(docKey.getTypename(), newName, docKey.getMediakey());
                        log = new WGUpdateLog(log.getType(), log.getDate(), log.getUser(), newKey.toString());
                    }
                }
               
                newLogs.add(log);
            }
View Full Code Here

    }
   
    private void fireDesignChangeEvent(VirtualDocument doc, int type) throws WGAPIException {
       
        List updateLogs = new ArrayList();
        updateLogs.add(new WGUpdateLog(type, new Date(), getName(), WGDocument.buildDocumentKey(doc, _db).toString()));
        WGDesignChangeEvent event = new WGDesignChangeEvent(this, _db, updateLogs);
        
        Iterator listeners = _designChangeListeners.iterator();
        while (listeners.hasNext()) {
            ((WGDesignChangeListener) listeners.next()).designChanged(event);
View Full Code Here

               
            Iterator logsIt = logs.iterator();
            String contentPrefix = WGDocument.TYPENAME_CONTENT + "/";
            while (logsIt.hasNext()) {
                Thread.yield();
                WGUpdateLog log = (WGUpdateLog) logsIt.next();
               
                // old notes-design does not support logs
                if ( (log == null) || (log.getDocumentKey() == null) ) {
                    _core.getLog().warn("Cannot process incremental index update for 'null' log or 'null' log.getDocumentKey() - ensure you use WGAContentStoreDesign >= 3.1.2");
                    continue;
                }

                if (!log.getDocumentKey().startsWith(contentPrefix)) {
                    continue;
                }
                if (log.getType() == WGUpdateLog.TYPE_DELETE) {
                    addDeletionRequest(new IndexingRequest(db.getDbReference(), log.getDocumentKey()));
                }
                else if (log.getType() == WGUpdateLog.TYPE_UPDATE) {
                    addDeletionRequest(new IndexingRequest(db.getDbReference(), log.getDocumentKey()));
                    WGContent content;
                    try {
                        content = (WGContent) db.getDocumentByDocumentKey(log.getDocumentKey());
                        if (content != null) {
                            addAdditionRequest(new IndexingRequest(db.getDbReference(), log.getDocumentKey()));
                        }
                    }
                    catch (WGAPIException e) {
                        _core.getLog().error("Unable to process log entry of type 'update'.", e);
                    }
View Full Code Here

TOP

Related Classes of de.innovationgate.webgate.api.WGUpdateLog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.