import sources from develop/0.1.0

This commit is contained in:
Thomas Peetz
2025-04-29 12:52:55 +02:00
parent 304005822c
commit 4c96de27db
976 changed files with 58265 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
apply plugin: 'java'
dependencies {
compile 'javax.enterprise:cdi-api:+'
compile 'org.jboss.spec.javax.faces:jboss-jsf-api_2.2_spec:+'
compile 'org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:+'
compile 'org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:+'
compile 'org.hibernate.ogm:hibernate-ogm-mongodb:+'
compile 'org.eclipse.persistence:javax.persistence:2.1.0'
compile 'ch.qos.logback:logback-core:1.1.2'
compile 'ch.qos.logback:logback-classic:1.1.2'
}
@@ -0,0 +1,62 @@
package com.ibtp.kontor.ejb;
import com.ibtp.kontor.ejb.PropertyManager;
import com.ibtp.kontor.ejb.Property;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.enterprise.inject.Model;
import javax.inject.Inject;
@Model
public class Controller {
List<Property> propertyList;
private String key;
private String value;
@PostConstruct
public void readDB() {
propertyList = ejb.queryCache();
}
@Inject
PropertyManager ejb;
public void save() {
Property p = new Property();
p.setKey(key);
p.setValue(value);
ejb.save(p);
propertyList.add(p);
key = "";
value = "";
}
public List<Property> getPropertyList() {
return propertyList;
}
public void setPropertyList(List<Property> propertyList) {
this.propertyList = propertyList;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
@@ -0,0 +1,37 @@
package com.ibtp.kontor.ejb;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.hibernate.annotations.GenericGenerator;
@Entity
public class Property {
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
private String id;
private String key;
private String value;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
@@ -0,0 +1,28 @@
package com.ibtp.kontor.ejb;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import com.ibtp.kontor.ejb.Property;
import javax.ejb.Stateless;
@Stateless
public class PropertyManager {
@PersistenceContext(unitName = "mongo-ogm")
private EntityManager em;
public void save(Property p) {
em.persist(p);
}
public List<Property> queryCache() {
Query query = em.createQuery("FROM Property p");
List<Property> list = query.getResultList();
return list;
}
}