org.sonar.batch.index
Class DefaultResourcePersister

java.lang.Object
  extended by org.sonar.batch.index.DefaultResourcePersister
All Implemented Interfaces:
ResourcePersister

public final class DefaultResourcePersister
extends Object
implements ResourcePersister


Constructor Summary
DefaultResourcePersister(DatabaseSession session, ResourcePermissions permissions, SnapshotCache snapshotCache, ResourceCache resourceCache)
           
 
Method Summary
 void clear()
           
 Snapshot getLastSnapshot(Snapshot snapshot, boolean onlyOlder)
          The current snapshot which is flagged as "last", different than the current analysis.
 Snapshot getSnapshot(Resource reference)
           
 Snapshot getSnapshotOrFail(InputFile inputFile)
           
 Snapshot getSnapshotOrFail(Resource resource)
           
 Snapshot saveProject(Project project, Project parent)
           
 Snapshot saveResource(Project project, Resource resource)
          Persist a resource in database.
 Snapshot saveResource(Project project, Resource resource, Resource parent)
          Persist a resource in database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultResourcePersister

public DefaultResourcePersister(DatabaseSession session,
                                ResourcePermissions permissions,
                                SnapshotCache snapshotCache,
                                ResourceCache resourceCache)
Method Detail

saveProject

public Snapshot saveProject(Project project,
                            @Nullable
                            Project parent)
Specified by:
saveProject in interface ResourcePersister

getSnapshot

@CheckForNull
public Snapshot getSnapshot(@Nullable
                                         Resource reference)
Specified by:
getSnapshot in interface ResourcePersister

getSnapshotOrFail

public Snapshot getSnapshotOrFail(Resource resource)
Specified by:
getSnapshotOrFail in interface ResourcePersister

getSnapshotOrFail

public Snapshot getSnapshotOrFail(InputFile inputFile)
Specified by:
getSnapshotOrFail in interface ResourcePersister

saveResource

public Snapshot saveResource(Project project,
                             Resource resource)
Description copied from interface: ResourcePersister
Persist a resource in database. Returns null if the resource must not be persisted (scope lower than file)

Specified by:
saveResource in interface ResourcePersister

saveResource

public Snapshot saveResource(Project project,
                             Resource resource,
                             @Nullable
                             Resource parent)
Description copied from interface: ResourcePersister
Persist a resource in database. Returns null if the resource must not be persisted (scope lower than file)

Specified by:
saveResource in interface ResourcePersister

getLastSnapshot

@CheckForNull
public Snapshot getLastSnapshot(Snapshot snapshot,
                                             boolean onlyOlder)
Description copied from interface: ResourcePersister
The current snapshot which is flagged as "last", different than the current analysis.

Specified by:
getLastSnapshot in interface ResourcePersister
onlyOlder - true if the result must be anterior to the snapshot parameter

clear

public void clear()
Specified by:
clear in interface ResourcePersister


Copyright © 2009–2015 SonarSource. All rights reserved.