Skip to content
Snippets Groups Projects
Commit a439d4cc authored by Thiemo Belmega's avatar Thiemo Belmega
Browse files

Provide bean format classes for all model classes

parent 5e462c90
No related branches found
No related tags found
No related merge requests found
package de.unipotsdam.cs.toolup.ws.beans;
import de.unipotsdam.cs.toolup.database.DatabaseController;
import de.unipotsdam.cs.toolup.exceptions.InvalidIdException;
import de.unipotsdam.cs.toolup.model.Application;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Collection;
public class ApplicationBean extends BusinessObjectBean {
private Collection<String> categories;
private Collection<String> features;
public ApplicationBean(Application app) throws InvalidIdException, SQLException, IOException {
super(app);
this.categories = app.getRelatedCategories();
this.features = app.getRelatedFeatures();
}
public Collection<String> getCategories() {
return categories;
}
public void setCategories(Collection<String> categories) {
this.categories = categories;
}
public Collection<String> getFeatures() {
return features;
}
public void setFeatures(Collection<String> features) {
this.features = features;
}
public static ApplicationBean getBean(String id) {
try {
Application app = (Application)DatabaseController.getInstance().load(id);
return new ApplicationBean(app);
} catch (SQLException e) {
e.printStackTrace();
} catch (InvalidIdException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
package de.unipotsdam.cs.toolup.ws.beans;
import de.unipotsdam.cs.toolup.model.BusinessObject;
public class BusinessObjectBean {
private String id;
private String title;
private String description;
public BusinessObjectBean(BusinessObject bo) {
this.id = bo.getUuid();
this.title = bo.getTitle();
this.description = bo.getDescription();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
package de.unipotsdam.cs.toolup.ws.beans;
import de.unipotsdam.cs.toolup.database.DatabaseController;
import de.unipotsdam.cs.toolup.exceptions.InvalidIdException;
import de.unipotsdam.cs.toolup.model.Category;
import de.unipotsdam.cs.toolup.model.Feature;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Collection;
public class CategoryBean extends BusinessObjectBean{
private Collection<String> applications;
public CategoryBean(Category cat) {
super(cat);
this.applications = cat.getRelatedApplications();
}
public static CategoryBean getBean(String id) {
try {
Category cat = (Category) DatabaseController.getInstance().load(id);
return new CategoryBean(cat);
} catch (SQLException e) {
e.printStackTrace();
} catch (InvalidIdException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
package de.unipotsdam.cs.toolup.ws.beans;
import de.unipotsdam.cs.toolup.database.DatabaseController;
import de.unipotsdam.cs.toolup.exceptions.InvalidIdException;
import de.unipotsdam.cs.toolup.model.Feature;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Collection;
public class FeatureBean extends BusinessObjectBean{
private Collection<String> applications;
public FeatureBean(Feature feat) {
super(feat);
this.applications = feat.getRelatedApplications();
}
public static FeatureBean getBean(String id) {
try {
Feature feat = (Feature) DatabaseController.getInstance().load(id);
return new FeatureBean(feat);
} catch (SQLException e) {
e.printStackTrace();
} catch (InvalidIdException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment