Moin moin,
mein IO-Tool, das ich gebaut habe, nimmt Formen an und ich bin grad an der Implementierung zwischen Model und GUI mittels MVC am werkeln.
Es gibt eine Funktion "checkOutCustomContent", die mit einer Pfad-Angabe arbeitet, blöderweise will die get-Methode des Projektnamens nicht arbeiten und liefert ein Blank zurück.
checkOut-Funktion in der Klasse "SVN-Repository"
Controller-Klasse mit actionPerformed-Funktion:
ProjectCreator-Klasse, die checkOut-Funktion beinhaltet.
Project-Klasse mit dem Attribut "Name"
Ich vermute, dass meine Deklaration von Project project in der ProjectCreator-Klasse den Fehler erzeugen könnte, aber warum nimmt die Checkout-Funktion nicht den aktuellen Wert des Namens an?
Wie könnte ich das fixen?
mein IO-Tool, das ich gebaut habe, nimmt Formen an und ich bin grad an der Implementierung zwischen Model und GUI mittels MVC am werkeln.
Es gibt eine Funktion "checkOutCustomContent", die mit einer Pfad-Angabe arbeitet, blöderweise will die get-Methode des Projektnamens nicht arbeiten und liefert ein Blank zurück.
checkOut-Funktion in der Klasse "SVN-Repository"
Java:
public void checkOutCustomContent(Project project, String targetPath)
throws SVNException {
this.executeCommand(TextConstants.svnCheckout
+ this.getRepositoryPath() + TextConstants.SVN_FILE_SEPARATOR
+ project.getName() + TextConstants.SVN_FILE_SEPARATOR
+ TextConstants.TRUNK + TextConstants.SVN_FILE_SEPARATOR
+ project.getName() + TextConstants.SVN_FILE_SEPARATOR
+ TextConstants.CUSTOMCONTENT + TextConstants.BLANK
+ targetPath.replace("\\", "/")
+ TextConstants.OS_FILE_SEPARATOR + TextConstants.CUSTOMCONTENT);
Controller-Klasse mit actionPerformed-Funktion:
Java:
public void actionPerformed(ActionEvent e) {
Object button = e.getSource();
if (button == graphicInterface.btnSubmit) {
try {
String temp = graphicInterface.getEingabe();
projectCreator.createProjectStructureInSVN(temp);
graphicInterface.btnConfigureDefaultsetups.setEnabled(true);
graphicInterface.textField_2.setText(TextConstants.REPOSITORY
+ TextConstants.SVN_FILE_SEPARATOR
+ graphicInterface.getEingabe());
} catch (SVNException e1) {
e1.printStackTrace();
}
} else {
if (button == graphicInterface.btnConfigureDefaultsetups) {
try {
projectCreator.checkOutCustomContentSVN();
projectCreator.commitCustomContent();
} catch (SVNException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
} else {
if (button == graphicInterface.btnClose) {
System.exit(0);
}
}
}
}
ProjectCreator-Klasse, die checkOut-Funktion beinhaltet.
Java:
public class ProjectCreator implements ProjectCreatorI {
private VersionControlRepository versionControl;
private MagicInstance magicInstance;
public Project project = new Project("");
Path thisPath = Paths.get("");
SVNRepository svnRepository = new SVNRepository(null, null,
TextConstants.REPOSITORY);
XML xml = new XML();
public String getProjectName(){
return project.getName();
}
public void createProjectStructureInSVN(String name) throws SVNException {
Project project = new Project(name);
// InputProjectName name = new InputProjectName();
// name.input(project);
svnRepository.createProjectStructure(project);
}
public void checkOutCustomContentSVN() throws SVNException {
svnRepository.checkOutCustomContent(project, thisPath.toAbsolutePath()
.toString());
xml.transferXMLwithProjectName(project, thisPath.toAbsolutePath()
.toString()
+ TextConstants.OS_FILE_SEPARATOR
+ TextConstants.CUSTOMCONTENT
+ TextConstants.OS_FILE_SEPARATOR
+ TextConstants.ENV + TextConstants.SVN_FILE_SEPARATOR);
}
public void commitCustomContent() throws SVNException {
svnRepository.addAllXMLforCommit(thisPath.toAbsolutePath().toString()
+ TextConstants.OS_FILE_SEPARATOR + TextConstants.CUSTOMCONTENT
+ TextConstants.OS_FILE_SEPARATOR);
svnRepository
.commitCustomContent(thisPath.toAbsolutePath().toString()
+ TextConstants.OS_FILE_SEPARATOR
+ TextConstants.CUSTOMCONTENT);
}
}
Project-Klasse mit dem Attribut "Name"
Java:
public class Project {
private String name;
public Project(String name) {
super();
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Ich vermute, dass meine Deklaration von Project project in der ProjectCreator-Klasse den Fehler erzeugen könnte, aber warum nimmt die Checkout-Funktion nicht den aktuellen Wert des Namens an?
Wie könnte ich das fixen?
Zuletzt bearbeitet: