Easy Keyword Bean

package com.xpagedeveloper;
import java.io.Serializable;
import java.util.Iterator;
import java.util.Vector;
import javax.faces.context.FacesContext;
package com.xpagedeveloper;
import java.io.Serializable;
import java.util.Iterator;
import java.util.Vector;
import javax.faces.context.FacesContext;
import lotus.domino.Database;
import lotus.domino.Document;

import lotus.domino.NotesException;
import lotus.domino.Session;
import lotus.domino.View;

import com.ibm.xsp.model.domino.DominoUtils;

public class FormHelpers implements Serializable {
 
    private static final long serialVersionUID = 2L;
	
 @SuppressWarnings("unchecked")
public static Vector <String> getKeyword(String Name){
	
	 Vector keyword= new Vector();
	 try {
	 Session session = DominoUtils.getCurrentSession(FacesContext.getCurrentInstance());
	 Database db=DominoUtils.getCurrentDatabase();
	 View view = db.getView("byKeyword");
	
	 Document Doc=view.getDocumentByKey(Name,true);
	 if(Doc!=null){
	 keyword=Doc.getItemValue("Data");
	 }
	 Doc.recycle();Doc=null;
	 view.recycle();view=null;
	 db.recycle();db=null;
	 } catch (NotesException e) {
	
		 System.out.println("Error1");
		}
	 
	 return keyword;
	 
 } 
 public static String getKeywordString(String Name,String Separator){
	 String Data="";
	 try{
	 Vector <String> keyword=getKeyword(Name);
	 if(!keyword.isEmpty()){
		 Iterator <String> i=keyword.iterator();
		 
		 while(i.hasNext()) {
		          String entry = i.next();
		          if("".equals(Data)){
		        	  Data=entry;
		          }else{
		        	  Data=Data+Separator;
		        	  Data=Data+entry;
		          }
		          System.out.println("2");
		  }
	 }
	
 }catch(Exception e){
	 System.out.println("Error 2");
 }
	 return Data; 
 }
}





a easy keyword bean explained in this blog post http://www.xpagedeveloper.com/2014/creating-an-easy-xpage-keyword-bean

Java
Fredrik Norling
September 7, 2014 1:25 PM
Rating
25

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.



No comments yetLogin first to comment...