Exemple #1
0
  public Commit createTerminal(String author, Object removed) {
    Validate.argumentsAreNotNull(author, removed);

    Cdo removedCdo = liveGraphFactory.createCdo(removed);

    return createTerminalByGlobalId(author, removedCdo.getGlobalId());
  }
Exemple #2
0
  public Commit create(String author, Object currentVersion) {
    Validate.argumentsAreNotNull(author, currentVersion);

    CommitMetadata commitMetadata = nextCommit(author);

    LiveGraph currentGraph = liveGraphFactory.createLiveGraph(currentVersion);
    ShadowGraph latestShadowGraph = graphSnapshotFacade.createLatestShadow(currentGraph);

    // capture current state
    List<CdoSnapshot> snapshots =
        graphSnapshotFacade.createGraphSnapshot(currentGraph, latestShadowGraph, commitMetadata);

    // do diff
    Diff diff = diffFactory.create(latestShadowGraph, currentGraph, Optional.of(commitMetadata));

    return new Commit(commitMetadata, snapshots, diff);
  }
Exemple #3
0
  public Commit createTerminalByGlobalId(String author, GlobalId removedId) {
    Validate.argumentsAreNotNull(author, removedId);

    Optional<CdoSnapshot> previousSnapshot = javersRepository.getLatest(removedId);
    if (previousSnapshot.isEmpty()) {
      throw new JaversException(
          JaversExceptionCode.CANT_DELETE_OBJECT_NOT_FOUND, removedId.value());
    }

    CommitMetadata commitMetadata = nextCommit(author);

    CdoSnapshot terminalSnapshot =
        snapshotFactory.createTerminal(removedId, previousSnapshot.get(), commitMetadata);

    Diff diff = diffFactory.singleTerminal(removedId, commitMetadata);

    return new Commit(commitMetadata, Lists.asList(terminalSnapshot), diff);
  }
Exemple #4
0
 @Override
 public Object getPropertyValue(String propertyName) {
   Validate.argumentIsNotNull(propertyName);
   Property property = getManagedType().getProperty(propertyName);
   return property.get(wrappedCdo);
 }
Exemple #5
0
 public Object getPropertyValue(String propertyName) {
   Validate.argumentIsNotNull(propertyName);
   Property property = getGlobalId().getCdoClass().getProperty(propertyName);
   return getPropertyValue(property);
 }
Exemple #6
0
 protected Cdo(GlobalId globalId) {
   Validate.argumentIsNotNull(globalId);
   this.globalId = globalId;
 }
Exemple #7
0
 Commit(CommitMetadata commitMetadata, List<CdoSnapshot> snapshots, Diff diff) {
   Validate.argumentsAreNotNull(commitMetadata, snapshots, diff);
   this.commitMetadata = commitMetadata;
   this.snapshots = snapshots;
   this.diff = diff;
 }
 ManagedClassFactory(
     PropertyScanner propertyScanner, ClassAnnotationsScanner classAnnotationsScanner) {
   Validate.argumentsAreNotNull(propertyScanner);
   this.propertyScanner = propertyScanner;
   this.classAnnotationsScanner = classAnnotationsScanner;
 }