Feed Xpages form Custom Control items through JavaBean get Method


/**
 * Copyright 2013 Dököll Solutions, Inc.
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 * 
 * Program: PageCosmeticsBean.java
 * @AppName: DöcuContent.nsf
 * Created: 2013.11.03.8.39.AM
 * JavaBean Class to load Page Cosmetics data to Xpages
 */
package com.dokoll.solutions.inc.developement.Utils;

import java.util.Enumeration;
import java.util.Vector;

import javax.faces.context.FacesContext;

import lotus.domino.Database;
import lotus.domino.Document;
import lotus.domino.DocumentCollection;
import lotus.domino.NotesException;
import lotus.domino.Session;
import lotus.domino.View;
import lotus.domino.ViewEntry;
import lotus.domino.ViewEntryCollection;

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



/**
 * @author Dököll Solutions, Inc.
 * @version: 2013.11.03.8.39.AM
 */
public class PageCosmeticsBean {

	//...
	Vector<String> vector;
	//...
	//declare static variable for comparison block
	//...
	//TO DO: Grab these values from NSF back-end and compare against the User's security items
	//allow user to view based on permissions
    static String USERID = "AlienHouse";
    static String COSMICTYPEADM = "Admin";
    static String COSMICTYPEDEV = "Dev";
    static String CSSITEM = "<xc:ccCSSItemA></xc:ccCSSItemA>";
    static String JSITEM = "<xc:ccJSItemA></xc:ccJSItemA>";
    static String IFRAMEITEM = "<xc:ccIFrameA></xc:ccIFrameA>";
    static String CHARTFRAMEITEM = "<xc:ccChartFrameA></xc:ccChartFrameA>";
    static String FORMTYPEITEM = "<xc:ccFormTypeA></xc:ccFormTypeA>";
    static String RICHTXTITEM = "<xc:ccRTFItemA></xc:ccRTFItemA>";
    static String RADIOGROUPITM = "<xc:ccRadioGroupA></xc:ccRadioGroupA>";
    static String CHECKBOXGROUPITEM = "<xc:ccCheckBoxGroupA></xc:ccCheckBoxGroupA>";
    static String ERRORGROUPITEM = "<xc:ccSingleErr></xc:SingleErr>";
    static String VERSIONINFOITEM = "<xc:ccVersionInfoA></xc:ccVersionInfoA>";
    static String PageCosmeticsViewName ="PageCosmeticsView";
    
    //...
    //SearchResults ID submitted
    //Use this to plug into UserPage Cosmetics
    //2013.11.03.10.50.PM
    public String SearchText;
    public String UserID;
    public String CosmicType;
    public String CSSItem;
    public String JSItem;
	public String IFrame;
	public String ChrtFrame;
	public String FrmType;
	public String RTFItem;
	public String RdGrp;
	public String CkGrp;
	public String ErrGrp;
	public String VerInfo;
	public String Priority;
	public String Status;
	public String Category;


	// getter/setter methods

	/**
	 * @return the userID
	 */
	public String getUserID() {
		return UserID;
	}

	/**
	 * @param userID the userID to set
	 */
	public void setUserID(String userID) {
		UserID = userID;
	}

	/**
	 * @return the cosmicType
	 */
	public String getCosmicType() {
		return CosmicType;
	}

	/**
	 * @param cosmicType the cosmicType to set
	 */
	public void setCosmicType(String cosmicType) {
		CosmicType = cosmicType;
	}

	/**
	 * @return the cSSItem
	 */
	public String getCSSItem() {
		return CSSItem;
	}

	/**
	 * @param item the cSSItem to set
	 */
	public void setCSSItem(String item) {
		CSSItem = item;
	}

	/**
	 * @return the jSItem
	 */
	public String getJSItem() {
		return JSItem;
	}

	/**
	 * @param item the jSItem to set
	 */
	public void setJSItem(String item) {
		JSItem = item;
	}

	/**
	 * @return the iFrame
	 */
	public String getIFrame() {
		return IFrame;
	}

	/**
	 * @param frame the iFrame to set
	 */
	public void setIFrame(String frame) {
		IFrame = frame;
	}

	/**
	 * @return the chrtFrame
	 */
	public String getChrtFrame() {
		return ChrtFrame;
	}

	/**
	 * @param chrtFrame the chrtFrame to set
	 */
	public void setChrtFrame(String chrtFrame) {
		ChrtFrame = chrtFrame;
	}

	/**
	 * @return the frmType
	 */
	public String getFrmType() {
		return FrmType;
	}

	/**
	 * @param frmType the frmType to set
	 */
	public void setFrmType(String frmType) {
		FrmType = frmType;
	}

	/**
	 * @return the rTFItem
	 */
	public String getRTFItem() {
		return RTFItem;
	}

	/**
	 * @param item the rTFItem to set
	 */
	public void setRTFItem(String item) {
		RTFItem = item;
	}

	/**
	 * @return the rdGrp
	 */
	public String getRdGrp() {
		if (COSMICTYPEADM.equalsIgnoreCase(CosmicType)) {	     
            System.out.println("User Access Okay() for..." + RdGrp);
            return "/ccRadioGroupA.xsp";
		}else {	     
            System.out.println("User Access Okay() for..." + RdGrp);
            return "/ccRadioGroupB.xsp";
		}//return RdGrp;
		//return "/ccRadioGroupC.xsp";
		
	}

	/**
	 * @param rdGrp the rdGrp to set
	 */
	public void setRdGrp(String rdGrp) {
		RdGrp = rdGrp;
	}

	/**
	 * @return the ckGrp
	 */
	public String getCkGrp() {
		return CkGrp;
	}

	/**
	 * @param ckGrp the ckGrp to set
	 */
	public void setCkGrp(String ckGrp) {
		CkGrp = ckGrp;
	}

	/**
	 * @return the errGrp
	 */
	public String getErrGrp() {
		return ErrGrp;
	}

	/**
	 * @param errGrp the errGrp to set
	 */
	public void setErrGrp(String errGrp) {
		ErrGrp = errGrp;
	}

	/**
	 * @return the verInfo
	 */
	public String getVerInfo() {
		return VerInfo;
	}

	/**
	 * @param verInfo the verInfo to set
	 */
	public void setVerInfo(String verInfo) {
		VerInfo = verInfo;
	}

	
	
	/**
	 * @return the searchText
	 */
	public String getSearchText() {

		return SearchText;
	}

	/**
	 * @param searchText the searchText to set
	 */
	public void setSearchText(String searchText) {
		SearchText = searchText;
	}
	
	
	
	
	
	
	/**
	 * @return the category
	 */
	public String getCategory() {
		
		if (COSMICTYPEADM.equalsIgnoreCase(CosmicType)) {	     
            System.out.println("User Access Okay() for..." + RdGrp);
            return "/ccRadioGroupE.xsp";
		}else {	     
            System.out.println("User Access Okay() for..." + RdGrp);
            return "/ccRadioGroupF.xsp";
		}//return RdGrp;
		//return "/ccRadioGroupC.xsp";
		
	}

	/**
	 * @param category the category to set
	 */
	public void setCategory(String category) {
		Category = category;
	}

	/**
	 * @return the priority
	 */
	public String getPriority() {
		if (COSMICTYPEADM.equalsIgnoreCase(CosmicType)) {	     
            System.out.println("User Access Okay() for..." + RdGrp);
            return "/ccRadioGroupC.xsp";
		}else {	     
            System.out.println("User Access Okay() for..." + RdGrp);
            return "/ccRadioGroupD.xsp";
		}//return RdGrp;
		//return "/ccRadioGroupC.xsp";
		//return Priority;
	}

	/**
	 * @param priority the priority to set
	 */
	public void setPriority(String priority) {
		Priority = priority;
	}

	/**
	 * @return the status
	 */
	public String getStatus() {
		
		if (COSMICTYPEADM.equalsIgnoreCase(CosmicType)) {	     
            System.out.println("User Access Okay() for..." + RdGrp);
            return "/ccRadioGroupG.xsp";
		}else {	     
            System.out.println("User Access Okay() for..." + RdGrp);
            return "/ccRadioGroupH.xsp";
		}//return RdGrp;
		//return "/ccRadioGroupC.xsp";
		//return Status;
	}

	/**
	 * @param status the status to set
	 */
	public void setStatus(String status) {
		Status = status;
	}

	/**
	  
	 * Method: PageSecurityAccessOkay()
	 * Created from Copy: 2012.08.26.2.08.AM
	 * Security Access Boolean for Xpages Controls (Hide/Show)
	 * 
	 */
	// links control, items on form vanish if Security access is 0 
	// for viewaccess, updateaccess, addaccess, and deleteaccess in NSF back-end
	public void PageSecurityAccessOkay() {

		// let's add a try catch here, to grab errors near the end
		try {
			
			// BEGIN DEBUG
		      System.out.println("BEGIN DEBUG | PageCosmeticsBean.java - PageSecurityAccessOkay started... ");
		      Session session = DominoUtils.getCurrentSession(FacesContext
						.getCurrentInstance());	
		      System.out.println("docucontent.nsf | PageSecurityAccessOkay() in PageCosmeticsBean.java Session Obtained..." + session);
				// find database in question from current session
				System.out.println("docucontent.nsf | PageSecurityAccessOkay() in PageCosmeticsBean.java finding FileBin.nsf based on Session...");
				Database database = session.getDatabase(session.getServerName(),"docucontent.nsf");
				System.out.println("PageSecurityAccessOkay() in PageCosmeticsBean.java Fetched Database..." + database);
				System.out.println("Getting a database connection... ");
		      
		      System.out.println("PageCosmeticsBean.java | PageSecurityAccessOkay Connected to " + database);
		      // Find the view in question
		      View view = database.getView(PageCosmeticsViewName);
		      System.out.println("PageCosmeticsBean.java | PageSecurityAccessOkay Connected to " + view);
		      //determine database state for searching
		      if (database.isFTIndexed())      
		        database.updateFTIndex(false);
		        else
		          database.updateFTIndex(true);
		 
		      //Collect entries based on search criteria in VIEWACCESS = username101
		      ViewEntryCollection vec =
		            view.getAllEntries();
		      
		            System.out.println("PageCosmeticsBean.java | ViewEntryCollection Counts Obtained...");
		            System.out.println("PageCosmeticsBean.java | ViewEntries " + vec.getCount() + " Account(s)");
		          System.out.println("PageCosmeticsBean.java | ViewEntryCollection completed successfully...");
		 
		          ViewEntry tmpentry;
		          ViewEntry entry = vec.getFirstEntry();

		         //make boolean available to the XP component 'rendered'
		          if (vec.getCount() > 0) {
		 
		        	CosmicType =  entry.getDocument().getItemValueString("CosmicType");
			        System.out.println("ENDING DEBUG | PageCosmeticsBean.java - PageSecurityAccessOkay accessed: " + CosmicType + " for Subject Field(s) / Radio controls... ");	  
		        	
		        	tmpentry = vec.getNextEntry();
		        	entry.recycle();
		        	entry = tmpentry;

		            // Boolean true
		            System.out.println("END DEBUG | PageCosmeticsBean.java - PageSecurityAccessOkay releasing access to controls... ");
		        //return true;
		          // END DEBUG
		          }
		 
		          } catch(NotesException e) {
		            System.out.println(e.id + " " + e.text);
		            e.printStackTrace();
		 
		    } catch (Exception e) {
		 
		      e.printStackTrace();
		    }
			return;
		  }
  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
}
	
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...