Aller directement à la fin des métadonnées
Aller au début des métadonnées

Here is the class diagram showing how to implement MetaFeed:

 

If you want to create a new meta feed type, you must build an new MetaFeedImpl inherited class which implements methods from the interface:

org.coretechs.Kimios.dms.MetaFeedImpl

Method

Description

getUid()

Return the UID of meta feed record

setUid()

Set the UID of meta feed record

getName()

Return the meta feed name

setName()

Set the meta feed name

setJavaClass()

Set the meta feed implementation class

getJavaClass()

Return the meta feed implementation class

toPojo()

Convert meta feed to plain old Java object from meta feed

getValues()

Return all meta feed values


Example with Enumeration meta feed implementation:

Implementation

A concrete example with Enumeration meta feed implementation. Methods have been deliberately simplified for understanding (do not use as it).

MetaFeedImpl

public class Enumeration extends MetaFeedImpl {
/**
Get values of Enumeration meta feed delegating to EnumerationValueFactory.
Return a Vector of String.
*/
public Vector<String> getValues() {
EnumerationValueFactory ef =
new FactoryInstantiator().getEnumerationValueFactory();
return ef.getValues(this.uid);
}
/**
Make searches from criteria into current meta feed
and return array of string as result.
*/
public String[] search(String criteria) {
Vector<String> r = new Vector<String>();
Vector<String> values = this.getValues();
for (String s : values) {
if (s.contains(criteria))
r.add(s);
}
String[] a = new String[r.size()];
return r.toArray(a);
}
}

 EnumerationValueFactory

public class HEnumerationValueFactory extends HFactory implements EnumerationValueFactory {
/**
Get values of Enumeration meta feed.
Return a Vector of String.
*/
public Vector<String> getValues(long uid) {
Vector<String> vValues = new Vector<String>();
List<String> lValues = session.createSQLQuery(
"SELECT ... FROM ... WHERE ... ORDER BY ...");
for(String st: lValues)
vValues.add(st);
return vValues;
}
/**
Update values of Enumeration meta feed with its uid and its values.
*/
public void updateValues(long uid, Vector<String> values) {
session.createSQLQuery("DELETE FROM ... WHERE ...").executeUpdate();
for(String b: values){
session.createSQLQuery(
"INSERT INTO ... (...) VALUES (...)")
.executeUpdate();
}
}
}
  • Aucune étiquette