Skip to content

Commit

Permalink
Recovered src folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
kimong committed Aug 30, 2023
1 parent 34a15c0 commit b3c4229
Show file tree
Hide file tree
Showing 52 changed files with 28,458 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package gov.nih.nci.evs.browser.bean;

import gov.nih.nci.evs.browser.utils.*;

/**
* <!-- LICENSE_TEXT_START -->
* Copyright 2008,2009 NGIT. This software was developed in conjunction
* with the National Cancer Institute, and so to the extent government
* employees are co-authors, any rights in such works shall be subject
* to Title 17 of the United States Code, section 105.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the disclaimer of Article 3,
* below. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* 2. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by NGIT and the National
* Cancer Institute." If no such end-user documentation is to be
* included, this acknowledgment shall appear in the software itself,
* wherever such third-party acknowledgments normally appear.
* 3. The names "The National Cancer Institute", "NCI" and "NGIT" must
* not be used to endorse or promote products derived from this software.
* 4. This license does not authorize the incorporation of this software
* into any third party proprietary programs. This license does not
* authorize the recipient to use any trademarks owned by either NCI
* or NGIT
* 5. THIS SOFTWARE IS PROVIDED "AS IS," AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, (INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE) ARE
* DISCLAIMED. IN NO EVENT SHALL THE NATIONAL CANCER INSTITUTE,
* NGIT, OR THEIR AFFILIATES BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* <!-- LICENSE_TEXT_END -->
*/

/**
* @author EVS Team (David Yee)
* @version 1.0
*/

public class BeanUtils {
public static UserSessionBean getUserSessionBean() {
return (UserSessionBean) HTTPUtils.getBean("userSessionBean",
"gov.nih.nci.evs.browser.bean.UserSessionBean");
}

public static IteratorBeanManager getIteratorBeanManager() {
return (IteratorBeanManager) HTTPUtils.getBean("iteratorBeanManager",
"gov.nih.nci.evs.browser.bean.IteratorBeanManager");
}

public static SearchStatusBean getSearchStatusBean() {
return (SearchStatusBean) HTTPUtils.getBean("searchStatusBean",
"gov.nih.nci.evs.browser.bean.SearchStatusBean");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package gov.nih.nci.evs.bean;

import java.io.*;
import java.util.*;
import java.net.*;

import com.google.gson.*;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
import com.thoughtworks.xstream.io.xml.DomDriver;
import com.thoughtworks.xstream.XStream;

public class Cart
{

// Variable declaration
private List<Concept> concepts;

// Default constructor
public Cart() {
}

// Constructor
public Cart(
List<Concept> concepts) {

this.concepts = concepts;
}

// Set methods
public void setConcepts(List<Concept> concepts) {
this.concepts = concepts;
}


// Get methods
public List<Concept> getConcepts() {
return this.concepts;
}

public String toXML() {
XStream xstream_xml = new XStream(new DomDriver());
String xml = xstream_xml.toXML(this);
xml = escapeDoubleQuotes(xml);
StringBuffer buf = new StringBuffer();
String XML_DECLARATION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
buf.append(XML_DECLARATION).append("\n").append(xml);
xml = buf.toString();
return xml;
}

public String toJson() {
JsonParser parser = new JsonParser();
Gson gson = new GsonBuilder().setPrettyPrinting().create();
return gson.toJson(this);
}

public String escapeDoubleQuotes(String inputStr) {
char doubleQ = '"';
StringBuffer buf = new StringBuffer();
for (int i=0; i<inputStr.length(); i++) {
char c = inputStr.charAt(i);
if (c == doubleQ) {
buf.append(doubleQ).append(doubleQ);
}
buf.append(c);
}
return buf.toString();
}
}
Loading

0 comments on commit b3c4229

Please sign in to comment.