Package com.sonymobile.tools.gerrit.gerritevents.dto

Examples of com.sonymobile.tools.gerrit.gerritevents.dto.RepositoryModifiedEvent


            if (gerritServer == null) {
                logger.trace("Gerrit Server null for item: {} !", item.id);
                return null;
            }

            RepositoryModifiedEvent repositoryModifiedEvent = (RepositoryModifiedEvent)gerritCause.getEvent();
            String eventDesc = getEventDescription(gerritCause.getEvent());
            logger.debug(eventDesc);
            Date createdOnDate = null;
            if (repositoryModifiedEvent instanceof ChangeBasedEvent) {
                PatchSet patchset = ((ChangeBasedEvent)repositoryModifiedEvent).getPatchSet();
                if (patchset != null) {
                    createdOnDate = patchset.getCreatedOn();
                }
            }

            if (replicationCache.isExpired(gerritCause.getEvent().getReceivedOn())) {
                logger.trace(eventDesc + " has expired");
                return null;
            }

            List<GerritSlave> slaves = gerritTrigger.gerritSlavesToWaitFor(gerritServer);
            if (!slaves.isEmpty()) {

                if (repositoryModifiedEvent.getModifiedProject() == null
                        || repositoryModifiedEvent.getModifiedRef() == null) {
                    return null;
                }

                if (createdOnDate != null && replicationCache.isExpired(createdOnDate.getTime())) {
                    logger.trace("{} has expired compared to createdOn date of patchset", eventDesc);
                    return null;
                }

                boolean useTimestampWhenProcessingRefReplicatedEvent = false;
                // we only need to perform a timestamp check if
                // we are looking at a RefUpdated event.
                // The reason for this is due to the fact that the ref
                // is not unique for RefUpdated events and we therefore
                // *need* to compare timestamps to ensure we use the
                // correct event.
                if (gerritCause.getEvent() instanceof RefUpdated) {
                    useTimestampWhenProcessingRefReplicatedEvent = true;
                }
                logger.debug(eventDesc + " is blocked");
                return new BlockedItem(repositoryModifiedEvent.getModifiedProject(),
                        repositoryModifiedEvent.getModifiedRef(),
                        gerritServer,
                        slaves,
                        gerritCause.getEvent().getReceivedOn(),
                        eventDesc,
                        useTimestampWhenProcessingRefReplicatedEvent);
View Full Code Here

TOP

Related Classes of com.sonymobile.tools.gerrit.gerritevents.dto.RepositoryModifiedEvent

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.