Commit db8acac2 authored by Tyler McAllister's avatar Tyler McAllister
Browse files

Takes .xmi and generates webpage

parent 7f5d6d10
......@@ -4,5 +4,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="lib" path="C:/Users/Ty/Downloads/org.eclipse.emf.ecore.xmi-2.15.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
package tdt4250.coursework;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;
......@@ -10,27 +12,38 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import tdt4250.coursework.University;
import tdt4250.coursework.impl.CourseworkFactoryImpl;
import tdt4250.coursework.CourseworkPackage;
import tdt4250.coursework.util.CourseworkResourceFactoryImpl;
public class CourseworkGen {
public static void main(String[] args) throws IOException {
University university = getQuiz(args[0]);
University university = getQuiz();
CourseworkHTMLGenerator generator = new CourseworkHTMLGenerator();
generator.generateHTML(university);
System.out.println("Test");
}
public static University getQuiz(String uriString) throws IOException {
public static University getQuiz() throws IOException {
ResourceSet resSet = new ResourceSetImpl();
resSet.getPackageRegistry().put(CourseworkPackage.eNS_URI, CourseworkPackage.eINSTANCE);
resSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("university", new CourseworkFactoryImpl());
Resource resource = resSet.getResource(URI.createURI(uriString), true);
resSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new CourseworkResourceFactoryImpl());
File f = new File("C:/Users/Ty/eclipse-workspace/tdt4250.coursework/model/NTNU.xmi");
Resource resource = resSet.getResource(URI.createFileURI(f.getAbsolutePath()), true);
for (EObject eObject : resource.getContents()) {
if (eObject instanceof University) {
System.out.println((University) eObject);
return (University) eObject;
}
}
return null;
}
public static String generateHtml(University newUniversity) throws FileNotFoundException {
CourseworkHTMLGenerator generator = new CourseworkHTMLGenerator();
generator.generateHTML(newUniversity);
//System.out.println(newUniversity.getCourse().get(0).getSemesterSpecificCourseInstance().get(0).getEvaluationform().getEvaluation());
return null;
}
}
package tdt4250.coursework;
import tdt4250.coursework.*;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
public abstract class CourseworkHTMLGenerator {
public class CourseworkHTMLGenerator {
ArrayList<String> generateHTML(University university){
ArrayList<String> generateHTML(University university) throws FileNotFoundException{
ArrayList<String> htmlPages = new ArrayList<String>();
// System.out.println(newUniversity.getCourse().getClass().getName());
PrintWriter out = new PrintWriter("C:\\Users\\Ty\\Documents\\AdvancedSoftwareDesign\\coursework.html");
int counter = 0;
for(Course course : university.getCourse()) {
htmlPages.add(generateCourseHTML(course));
counter++;
out.println(htmlPages);
System.out.println(counter);
}
for(int i = 0; i < htmlPages.size(); i++) {
System.out.println(htmlPages.get(i));
}
return htmlPages;
}
......@@ -160,9 +169,4 @@ public abstract class CourseworkHTMLGenerator {
timetableDiv += "</table></div>";
return timetableDiv;
}
public static void main(String[] args) {
Course uni = new Course();
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment