📄 refprovider.java
字号:
/*
* Created on Jul 10, 2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package ar.com.koalas.providers;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import org.apache.commons.jxpath.JXPathContext;
import org.xml.sax.SAXException;
/**
* @author DZ156H
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class RefProvider extends ProviderImpl {
private String refProvider;
private String filter;
public void setReference( String reference ){
this.refProvider = reference;
}
public void setFilter( String filter ){
this.filter = filter;
}
public Collection getCollection() throws ProviderException {
try {
Provider provider = ProviderFactory.getInstance().getProvider( this.refProvider );
JXPathContext context = JXPathContext.newContext( provider );
Iterator iterator = context.iterate( this.filter );
return this.getCollection( iterator );
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* @param iterator
* @return
*/
private Collection getCollection(Iterator iterator){
Collection arrayList = new ArrayList();
while( iterator.hasNext() ){
arrayList.add( iterator.next() );
}
return arrayList;
}
public Object getDescription(Object id) throws ProviderException {
try {
return ProviderFactory.getInstance().getProvider(this.refProvider).getDescription( id );
} catch (IOException e) {
// XXX Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) {
// XXX Auto-generated catch block
e.printStackTrace();
}
return null;
}
public String getKeyName() {
String retValue = super.getKeyName();
if( retValue != null ){
return retValue;
}
try {
Provider provider = ProviderFactory.getInstance().getProvider(this.refProvider);
return provider.getKeyName();
} catch (IOException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
}
return null;
}
public String getDescription() {
String retValue = super.getKeyName();
if( retValue != null ){
return retValue;
}
try {
Provider provider = ProviderFactory.getInstance().getProvider(this.refProvider);
return provider.getDescription();
} catch (IOException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
}
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -