Last active
December 17, 2015 00:59
-
-
Save mbruch/5525065 to your computer and use it in GitHub Desktop.
Forms and Database Services API For each class in here: # Copy the raw text of the class, # Select the src folder of com.example.miniscout.shared, # Press ctrl+v to get the class inserted correctly by Eclipse.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.miniscout.shared; | |
public class Field { | |
public Field(String type, String name, String value) { | |
super(); | |
this.type = type; | |
this.name = name; | |
this.value = value; | |
} | |
public Field() { | |
} | |
public String type; | |
public String name; | |
public String value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.miniscout.shared; | |
public class Form { | |
public String name; | |
public Field[] fields = new Field[0]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.miniscout.shared; | |
import java.net.URI; | |
public interface IDatabaseService { | |
public Form load(URI source) throws Exception; | |
public void save(Form form, URI target) throws Exception; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.miniscout.client.editor; | |
import java.net.URI; | |
import com.example.miniscout.shared.Field; | |
import com.example.miniscout.shared.Form; | |
import com.example.miniscout.shared.IDatabaseService; | |
public class Services { | |
private static final IDatabaseService INSTANCE = new IDatabaseService() { | |
// simple "in memory" database. will be replaced by an OSGI service later | |
@Override | |
public Form load(URI source) throws Exception { | |
Form form = new Form(); | |
form.name = "In Memory Form"; | |
form.fields = new Field[] { new Field("string", "forename", "Max"), | |
new Field("string", "lastname", "Mustermann"), | |
new Field("string", "street", "Seestraße 7") }; | |
return form; | |
} | |
@Override | |
public void save(Form form, URI target) throws Exception { | |
// do nothing. | |
} | |
}; | |
public static IDatabaseService getDatbaseService() { | |
return INSTANCE; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment