96 lines
2.1 KiB
Java
96 lines
2.1 KiB
Java
package com.svnmanager.model;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* SVN状态模型
|
|
*/
|
|
public class SvnStatus {
|
|
private String workingCopyPath;
|
|
private String revision;
|
|
private List<SvnFileStatus> files;
|
|
private int modifiedCount;
|
|
private int addedCount;
|
|
private int deletedCount;
|
|
private int conflictedCount;
|
|
|
|
public SvnStatus() {
|
|
this.files = new ArrayList<>();
|
|
}
|
|
|
|
public String getWorkingCopyPath() {
|
|
return workingCopyPath;
|
|
}
|
|
|
|
public void setWorkingCopyPath(String workingCopyPath) {
|
|
this.workingCopyPath = workingCopyPath;
|
|
}
|
|
|
|
public String getRevision() {
|
|
return revision;
|
|
}
|
|
|
|
public void setRevision(String revision) {
|
|
this.revision = revision;
|
|
}
|
|
|
|
public List<SvnFileStatus> getFiles() {
|
|
return files;
|
|
}
|
|
|
|
public void setFiles(List<SvnFileStatus> files) {
|
|
this.files = files;
|
|
updateCounts();
|
|
}
|
|
|
|
public void addFile(SvnFileStatus file) {
|
|
this.files.add(file);
|
|
updateCounts();
|
|
}
|
|
|
|
public int getModifiedCount() {
|
|
return modifiedCount;
|
|
}
|
|
|
|
public int getAddedCount() {
|
|
return addedCount;
|
|
}
|
|
|
|
public int getDeletedCount() {
|
|
return deletedCount;
|
|
}
|
|
|
|
public int getConflictedCount() {
|
|
return conflictedCount;
|
|
}
|
|
|
|
public int getTotalChangedFiles() {
|
|
return modifiedCount + addedCount + deletedCount + conflictedCount;
|
|
}
|
|
|
|
private void updateCounts() {
|
|
modifiedCount = 0;
|
|
addedCount = 0;
|
|
deletedCount = 0;
|
|
conflictedCount = 0;
|
|
|
|
for (SvnFileStatus file : files) {
|
|
switch (file.getStatus()) {
|
|
case MODIFIED:
|
|
modifiedCount++;
|
|
break;
|
|
case ADDED:
|
|
addedCount++;
|
|
break;
|
|
case DELETED:
|
|
deletedCount++;
|
|
break;
|
|
case CONFLICTED:
|
|
conflictedCount++;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|