Iterator<AssetItem> leftExistingIter = leftPackage.getAssets();
while (leftExistingIter.hasNext()) {
AssetItem left = leftExistingIter.next();
if ( isPackageItemDeleted( rightPackage,
left ) ) {
SnapshotDiff diff = new SnapshotDiff();
diff.name = left.getName();
diff.diffType = SnapshotDiff.TYPE_DELETED;
diff.leftUuid = left.getUUID();
list.add( diff );
}
}
Iterator<AssetItem> rightExistingIter = rightPackage.getAssets();
while (rightExistingIter.hasNext()) {
AssetItem right = rightExistingIter.next();
AssetItem left = null;
if ( right != null && leftPackage.containsAsset( right.getName() ) ) {
left = leftPackage.loadAsset( right.getName() );
}
// Asset is deleted or added
if ( right == null || left == null ) {
SnapshotDiff diff = new SnapshotDiff();
if ( left == null ) {
diff.name = right.getName();
diff.diffType = SnapshotDiff.TYPE_ADDED;
diff.rightUuid = right.getUUID();
}
list.add( diff );
} else if ( isAssetArchivedOrRestored( right,
left ) ) { // Has the asset
// been archived
// or restored
SnapshotDiff diff = new SnapshotDiff();
diff.name = right.getName();
diff.leftUuid = left.getUUID();
diff.rightUuid = right.getUUID();
if ( left.isArchived() ) {
diff.diffType = SnapshotDiff.TYPE_RESTORED;
} else {
diff.diffType = SnapshotDiff.TYPE_ARCHIVED;
}
list.add( diff );
} else if ( isAssetItemUpdated( right,
left ) ) { // Has the asset been
// updated
SnapshotDiff diff = new SnapshotDiff();
diff.name = right.getName();
diff.leftUuid = left.getUUID();
diff.rightUuid = right.getUUID();
diff.diffType = SnapshotDiff.TYPE_UPDATED;