Removing AXIS web services. NIHVIVO-415

This commit is contained in:
bdc34 2010-05-19 19:52:29 +00:00
parent f88a77d307
commit 8b7d510e26
11 changed files with 28 additions and 903 deletions

View file

@ -14,8 +14,8 @@ import java.util.Set;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.axis.components.logger.LogFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.query.Query;

View file

@ -1,286 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webservices;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServlet;
import org.apache.axis.MessageContext;
import org.apache.axis.transport.http.HTTPConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.joda.time.DateTime;
import org.joda.time.Interval;
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
import edu.cornell.mannlib.vitro.webapp.dao.TabDao;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.dao.filtering.WebappDaoFactoryFiltering;
import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilterUtils;
import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilters;
/**
* This is exposed by apache axis to provide a web service where folks can
* get tabs and simple entities. Jim doesn't seem to be using the properties so
* they are commented out.
*
*
* Created: Wed Aug 16 11:36:15 2006
* @version 1.0
*/
public class VitroWs {
//private VitroFacade vf;
//private WebappDaoFactory webDaoFactory;
//private ApplicationBean appBean;
private DateTime previousCall;
private ServletContext ctx;
Log log = LogFactory.getLog(VitroWs.class);
public VitroWs() {
previousCall = (new DateTime()).minusDays(200);
//wow, this is how to get a servlet context in axis.
HttpServlet srv =
(HttpServlet)MessageContext.getCurrentContext().getProperty(HTTPConstants.MC_HTTP_SERVLET);
this.ctx = srv.getServletContext();
}
private WebappDaoFactory getWdf(){
return (WebappDaoFactory)ctx.getAttribute("webappDaoFactory");
}
private ApplicationBean getAppBean(){
return new ApplicationBean(); //is this the correct way to get one of these?
}
/**
Gets a tab with related entities. The returned Tab does not have
child tab list filled.
withEntities parameter is ignored since it can create huge result sets.
The tab specified by tabid has entities, any children tabs should not.
depth parameter is only valid for 0 and 1. All other values will be treated as 1.
*/
public Tab getFullTab(int tabid, int portalid, int depth, boolean withEntities){
if( log.isDebugEnabled() )
log.debug("calling getFullTab( tabid=" + tabid + ", portalid="
+ portalid + ", depth=" + depth + ", withEntitys="
+ withEntities + ")");
long wait = checkCongestion();
if( wait > 0 )
try {
Thread.sleep(wait);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Tab tab = null;
try{
VitroFilters dateFilter = VitroFilterUtils.getSunsetWindowFilter(new Date());
WebappDaoFactory wdf = new WebappDaoFactoryFiltering(getWdf(), dateFilter);
TabDao tabdao= wdf.getTabDao();
tab = tabdao.getTab(tabid, PUBLIC_AUTH_LEVEL,getAppBean(), depth);
if( tab == null ) return null;
if( withEntities )
tab.setRelatedEntityList(tab.getRelatedEntityList(null));//null indicates no alpha filtering
else
tab.setRelatedEntityList(Collections.EMPTY_LIST);
strip( tab );
tab.placeEntityFactory(null);
}catch(RuntimeException re){
log.error("Exception in getFullTab",re);
}
return tab;
}
/** Gets Entity with properties filled out. */
public Individual getFullEntityById(String entityUri, int portalid){
if( log.isDebugEnabled() )
log.debug("calling getFullEntityById( entityUri=" + entityUri +
", " + portalid + ")");
long wait = checkCongestion();
if( wait > 0 )
try {
Thread.sleep(wait);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
if (entityUri==null) {
return null;
}
Individual entity = getWdf().getIndividualDao().getIndividualByURI( entityUri );
if (entity==null) {
return null;
}
setUpEntity(entity);
setUpDescription(entity);
return entity;
} catch (RuntimeException e) {
log.error("error in getFullEntityById()" , e);
return null;
}
}
public List getTabsForPortal( int portalid ){
if( log.isDebugEnabled() )
log.debug("calling getTabsForPortal( portalid=" + portalid + ")");
long wait = checkCongestion();
if( wait > 0 )
try {
Thread.sleep(wait);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
return getWdf().getTabDao().getTabsForPortal(portalid);
}catch(RuntimeException e){
log.error("error in getTabsForPortal()" ,e );
return Collections.EMPTY_LIST;
}
}
private void setUpEntity(Individual entity){
if (entity != null && entity.getURI()!=null) {
WebappDaoFactory webDaoFactory = getWdf();
webDaoFactory.getObjectPropertyStatementDao().fillExistingObjectPropertyStatements(entity);
webDaoFactory.getIndividualDao().fillVClassForIndividual( entity );
webDaoFactory.getLinksDao().addLinksToIndividual( entity );
entity.setKeywords(webDaoFactory.getIndividualDao().getKeywordsForIndividual(entity.getURI()));
// jc55 apparently causing problems for Entrepreneurship web services
entity.setHiddenFromDisplayBelowRoleLevel(null);
entity.setProhibitedFromUpdateBelowRoleLevel(null);
}
}
/**
* Set entity up with a description from data props if there is none.
*
* @param entity
*/
private void setUpDescription(Individual entity) {
if( entity != null &&
(entity.getDescription() == null || entity.getDescription().length() == 0)){
//if there is nothing in the desc then try to get a dataprop and stick that in the desc
List e2d = entity.getDataPropertyStatements();
if( e2d != null && e2d.size() > 0 ){
Iterator it = e2d.iterator();
while(it.hasNext()){
/* If there is no description the overviewStatement or researchFocus get
* stuck into the description field. */
DataPropertyStatement data = (DataPropertyStatement) it.next();
if( OVERVIEW_STATEMENT_DATAPROP_URI.equals( data.getDatapropURI() )
&& data.getData() != null && data.getData().length() > 0){
//see jira issue VITRO-415
//http://issues.library.cornell.edu/browse/VITRO-415
entity.setDescription(data.getData());
break;
}else if( RESEARCH_FOCUS_DATAPROP_URI.equals( data.getDatapropURI() )
&& data.getData() != null && data.getData().length() > 0 ){
entity.setDescription(data.getData());
break;
}
}
}
}
}
private void strip(Tab tab ){
if( tab == null ) return;
if( tab.getChildTabs() != null ){
for( Tab childTab : tab.getChildTabs()){
childTab.setChildTabs(null);
childTab.setRelatedEntityList(Collections.EMPTY_LIST);
}
}
if( tab.getRelatedEntities() != null ){
for( Individual ind : tab.getRelatedEntities()){
strip(ind);
}
}
}
private void strip(Individual ind){
getWdf().getObjectPropertyDao().fillObjectPropertiesForIndividual(ind);
List<ObjectProperty> props = ind.getObjectPropertyList();
if( props != null && props.size() > 0 ){
ListIterator<ObjectProperty> iterator = props.listIterator();
while(iterator.hasNext()){
ObjectProperty prop= iterator.next();
// jc55 unlikely to be the source of the problem, but try anyway
prop.setProhibitedFromUpdateBelowRoleLevel(null);
prop.setHiddenFromDisplayBelowRoleLevel(null);
if(! ( HAS_TEACHER.equals( prop.getURI() )
|| IN_SEMESTER.equals( prop.getURI()) )){
iterator.remove();
}
}
}
ind.setHiddenFromDisplayBelowRoleLevel(null);
ind.setProhibitedFromUpdateBelowRoleLevel(null);
ind.setDatatypePropertyList(Collections.EMPTY_LIST);
ind.setDataPropertyStatements(Collections.EMPTY_LIST);
ind.setKeywords(Collections.EMPTY_LIST);
}
private synchronized int checkCongestion() {
DateTime now = new DateTime();
Interval sincePrevious = new Interval(previousCall, now );
this.previousCall = now;
long since = sincePrevious.toDurationMillis();
if( since < 660 )
return 2000;
else if ( since < 1200 )
return 600;
else
return 0;
}
private static final int PUBLIC_AUTH_LEVEL = 0;
private static final String RESEARCH_FOCUS_DATAPROP_URI = "http://vivo.library.cornell.edu/ns/0.1#researchFocus";
private static final String OVERVIEW_STATEMENT_DATAPROP_URI = "http://vivo.library.cornell.edu/ns/0.1#overviewStatement";
private static final String HAS_TEACHER = "http://vivo.library.cornell.edu/ns/0.1#SemesterCourseHasTeacherPerson";
private static final String IN_SEMESTER = "http://vivo.library.cornell.edu/ns/0.1#SemesterCourseOccursInSemester";
}

View file

@ -1,29 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webservices.serializers;
import org.apache.axis.Constants;
import org.apache.axis.encoding.SerializerFactory;
import java.util.Iterator;
import java.util.Vector;
/**
* * This is used to by the axis webservices. see vitro/webservices/wsdd/VitroWs.wsdd
*/
public class EntitySerFactory implements SerializerFactory {
private Vector mechanisms;
public EntitySerFactory() {
}
public javax.xml.rpc.encoding.Serializer getSerializerAs(String mechanismType) {
return new EntitySerializer();
}
public Iterator getSupportedMechanismTypes() {
if (mechanisms == null) {
mechanisms = new Vector();
mechanisms.add(Constants.AXIS_SAX);
}
return mechanisms.iterator();
}
}

View file

@ -1,174 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webservices.serializers;
import java.io.IOException;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import javax.xml.namespace.QName;
import org.apache.axis.Constants;
import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.encoding.Serializer;
import org.apache.axis.wsdl.fromJava.Types;
import org.w3c.dom.Element;
import org.xml.sax.Attributes;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.Link;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
/**
* WARNING: SUPER AWFUL, OBJECT ORIENTED NO-NO'S AHEAD
* -- !serializing an entity will change it! --
* * This is used to by the axis webservices. see vitro/webservices/wsdd/VitroWs.wsdd
*/
public class EntitySerializer implements Serializer {
public static final QName myTypeQName = new QName("typeNS", "VitroEntity");
public static final String ID_MBER = "id";
public static final String NAME_MBER= "name";
public static final String MONIKER_MBER= "moniker";
public static final String VCLASS_MBER= "vClass";
public static final String URL_MBER= "url";
public static final String DESCRIPTION_MBER= "description";
public static final String SUNRISE_MBER= "sunrise";
public static final String SUNSET_MBER= "sunset";
public static final String TIMEKEY_MBER= "timekey";
//public static final String MODTIME_MBER= "modTime";
public static final String IMAGEFILE_MBER= "imageFile";
public static final String ANCHOR_MBER= "anchor";
public static final String BLURB_MBER= "blurb";
public static final String IMAGETHUMB_MBER= "imageThumb";
public static final String CITATION_MBER= "citation";
public static final String STATUS_MBER= "status";
public static final String PROPERTYLIST_MBER= "propertyList";
public static final String LINKSLIST_MBER= "linksList";
public static final String KEYWORDS_MBER="keywords";
public static final String VCLASSID_MBER= "vClassId";
/** this is not on the original Entity object */
public static final String RELATED_ENTITIES_MBER ="relatedEntities";
/**
* Serialize an element named name, with the indicated attributes
* and value.
* @param name is the element name
* @param attributes are the attributes...serialize is free to add more.
* @param value is the value
* @param context is the SerializationContext
*/
public void serialize(QName name, Attributes attributes,
Object value, SerializationContext context)
throws IOException
{
if (!(value instanceof Individual))
throw new IOException("Can't serialize a " + value.getClass().getName() + " with a EntitySerializer.");
Individual ent = (Individual)value;
// jc55 causes problems with web services if populated
ent.setHiddenFromDisplayBelowRoleLevel(null);
ent.setProhibitedFromUpdateBelowRoleLevel(null);
context.startElement(name, attributes);
prepareForSerialization( ent );
context.serialize(new QName("", ID_MBER), null, ent.getURI());
context.serialize(new QName("", NAME_MBER), null, ent.getName());
context.serialize(new QName("", MONIKER_MBER), null, ent.getMoniker());
VClass vc = ent.getVClass();
vc.setHiddenFromDisplayBelowRoleLevel(null);
vc.setProhibitedFromUpdateBelowRoleLevel(null);
context.serialize(new QName("", VCLASS_MBER), null, ent.getVClass());
context.serialize(new QName("", URL_MBER), null, ent.getUrl());
context.serialize(new QName("", DESCRIPTION_MBER), null, ent.getDescription());
context.serialize(new QName("", SUNRISE_MBER), null, ent.getSunrise());
context.serialize(new QName("", SUNSET_MBER), null, ent.getSunset());
context.serialize(new QName("", TIMEKEY_MBER), null, ent.getTimekey());
context.serialize(new QName("", IMAGEFILE_MBER), null, ent.getImageFile());
context.serialize(new QName("", ANCHOR_MBER), null, ent.getAnchor());
context.serialize(new QName("", BLURB_MBER), null, ent.getBlurb());
context.serialize(new QName("", IMAGETHUMB_MBER), null, ent.getImageThumb());
context.serialize(new QName("", CITATION_MBER), null, ent.getCitation());
context.serialize(new QName("", STATUS_MBER), null, ent.getStatus());
List<Link> llist = ent.getLinksList();
if( llist != null ){
for(Link link : llist ){
link.setHiddenFromDisplayBelowRoleLevel(null);
link.setProhibitedFromUpdateBelowRoleLevel(null);
link.setObjectPropertyStatement(null);
link.setTypeURI(null);
}
}
context.serialize(new QName("", LINKSLIST_MBER), null, ent.getLinksList());
context.serialize(new QName("", KEYWORDS_MBER), null, ent.getKeywords());
context.serialize(new QName("", VCLASSID_MBER), null, ent.getVClassURI());
//after the minimize this should only have property->ents2ent with no Entity objs.
context.serialize(new QName("", PROPERTYLIST_MBER), null, ent.getObjectPropertyList());
context.endElement();
}
public String getMechanismType() { return Constants.AXIS_SAX; }
public Element writeSchema(Class javaType, Types types) throws Exception {
return null;
}
/**
* 1) reflects props and ents2ents domainside,
* 2) sorts
* 3) removed domain Entity object from all ents2ents
*
*/
private final void prepareForSerialization(final Individual ent){
if( ent == null || ent.getObjectPropertyList() == null) return;
ent.sortForDisplay();
//ent.forceAllPropertiesDomainSide();
Iterator it = ent.getObjectPropertyList().iterator();
while(it.hasNext()){
ObjectProperty prop = (ObjectProperty)it.next();
prepareProperty(prop);
}
}
/**
* calls prepareEnts2Ents on each ents2ents of Property
*/
private final void prepareProperty(final ObjectProperty prop){
if( prop == null || prop.getObjectPropertyStatements() == null ) return;
prop.setHiddenFromDisplayBelowRoleLevel(null);
prop.setProhibitedFromUpdateBelowRoleLevel(null);
Iterator it = prop.getObjectPropertyStatements().iterator();
while(it.hasNext()){
prepareEnts2Ents((ObjectPropertyStatement)it.next());
}
}
private final void prepareEnts2Ents(final ObjectPropertyStatement e2e ){
if( e2e != null){
e2e.setSubject(null);
e2e.setProperty(null);
//we don't want to serialize any deeper
Individual objInd = e2e.getObject();
objInd.setObjectPropertyStatements(Collections.EMPTY_LIST);
objInd.setDataPropertyStatements(Collections.EMPTY_LIST);
objInd.setPropertyList(Collections.EMPTY_LIST);
objInd.setDatatypePropertyList(Collections.EMPTY_LIST);
}
}
}

View file

@ -1,29 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webservices.serializers;
import org.apache.axis.Constants;
import org.apache.axis.encoding.SerializerFactory;
import java.util.Iterator;
import java.util.Vector;
/**
* * This is used to by the axis webservices. see vitro/webservices/wsdd/VitroWs.wsdd
*/
public class Ents2EntsSerFactory implements SerializerFactory {
private Vector mechanisms;
public Ents2EntsSerFactory() {
}
public javax.xml.rpc.encoding.Serializer getSerializerAs(String mechanismType) {
return new Ents2EntsSerializer();
}
public Iterator getSupportedMechanismTypes() {
if (mechanisms == null) {
mechanisms = new Vector();
mechanisms.add(Constants.AXIS_SAX);
}
return mechanisms.iterator();
}
}

View file

@ -1,111 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webservices.serializers;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
import org.apache.axis.Constants;
import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.encoding.Serializer;
import org.apache.axis.wsdl.fromJava.Types;
import org.w3c.dom.Element;
import org.xml.sax.Attributes;
import javax.xml.namespace.QName;
import java.io.IOException;
/**
* This is used to by the axis webservices. see vitro/webservices/wsdd/VitroWs.wsdd
*/
public class Ents2EntsSerializer implements Serializer {
public static final QName myTypeQName = new QName("typeNS", "VitroEntity");
public static final String ENTS2ENTSID_MBER = "ents2entsId";
public static final String DOMAINID_MBER = "domainId";
public static final String DOMAIN_MBER = "domain";
public static final String RANGEID_MBER = "rangeId";
public static final String RANGE_MBER = "range";
public static final String PROPERTYID_MBER = "propertyId";
public static final String PROPERTY_MBER = "property";
public static final String QUALIFIER_MBER = "qualifier";
public static final String DOMAINORIENTED_MBER = "domainOriented";
/**
* Serialize an element named name, with the indicated attributes
* and value.
* @param name is the element name
* @param attributes are the attributes...serialize is free to add more.
* @param value is the value
* @param context is the SerializationContext
*/
public void serialize(QName name, Attributes attributes,
Object value, SerializationContext context)
throws IOException
{
if (!(value instanceof ObjectPropertyStatement))
throw new IOException("Can't serialize a " + value.getClass().getName() + " with a Ents2EntsSerializer.");
ObjectPropertyStatement e2e = (ObjectPropertyStatement)value;
context.startElement(name, attributes);
//context.serialize(new QName("", ENTS2ENTSID_MBER), null, e2e.getEnts2entsId());
//context.serialize(new QName("", DOMAINID_MBER), null, e2e.getDomainId());
//context.serialize(new QName("", DOMAIN_MBER), null, e2e.getDomain());
context.serialize(new QName("", RANGEID_MBER), null, e2e.getObjectURI());
//we don't want to serialize any further.
Individual object = e2e.getObject();
object.setObjectPropertyStatements(null);
context.serialize(new QName("", RANGE_MBER), null, object);
//context.serialize(new QName("", PROPERTYID_MBER), null, e2e.getPropertyId());
//context.serialize(new QName("", PROPERTY_MBER), null, e2e.getProperty());
context.serialize(new QName("", QUALIFIER_MBER), null, e2e.getQualifier());
context.endElement();
}
public String getMechanismType() { return Constants.AXIS_SAX; }
public Element writeSchema(Class javaType, Types types) throws Exception {
return null;
}
// /**
// * 1) reflects props and ents2ents domainside,
// * 2) sorts
// * 3) removed domain Entity object from all ents2ents
// *
// */
// private final void prepareForSerialization(final Entity ent){
// if( ent == null || ent.getPropertyList() == null) return;
// ent.sortForDisplay();
// ent.forceAllPropertiesDomainSide();
// Iterator it = ent.getPropertyList().iterator();
// while(it.hasNext()){
// Property prop = (Property)it.next();
// prepareProperty(prop);
// }
// }
// /**
// * calls prepareEnts2Ents on each ents2ents of Property
// */
// private final void prepareProperty(final Property prop){
// if( prop == null || prop.getEnts2Ents() == null ) return;
// Iterator it = prop.getEnts2Ents().iterator();
// while(it.hasNext()){
// prepareEnts2Ents((Ents2Ents)it.next());
// }
// }
// private final void prepareEnts2Ents(final Ents2Ents e2e ){
// if( e2e != null){
// e2e.setDomain(null);
// e2e.setProperty(null);
// }
// }
}

View file

@ -1,29 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webservices.serializers;
import org.apache.axis.Constants;
import org.apache.axis.encoding.SerializerFactory;
import java.util.Iterator;
import java.util.Vector;
/**
* * This is used to by the axis webservices. see vitro/webservices/wsdd/VitroWs.wsdd
*/
public class EshipRetroObjectPropertySerFactory implements SerializerFactory {
private Vector mechanisms;
public EshipRetroObjectPropertySerFactory () {
}
public javax.xml.rpc.encoding.Serializer getSerializerAs(String mechanismType) {
return new EshipRetroObjectPropertySerializer();
}
public Iterator getSupportedMechanismTypes() {
if (mechanisms == null) {
mechanisms = new Vector();
mechanisms.add(Constants.AXIS_SAX);
}
return mechanisms.iterator();
}
}

View file

@ -1,73 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webservices.serializers;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import org.apache.axis.Constants;
import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.encoding.Serializer;
import org.apache.axis.wsdl.fromJava.Types;
import org.w3c.dom.Element;
import org.xml.sax.Attributes;
import javax.xml.namespace.QName;
import java.io.IOException;
import java.util.List;
/**
* This is used to by the axis webservices. see vitro/webservices/wsdd/VitroWs.wsdd
*/
public class EshipRetroObjectPropertySerializer implements Serializer {
public static final QName myTypeQName = new QName("typeNS", "VitroEntity");
public static final String ENTS2ENTSID_MBER = "ents2entsId";
public static final String DOMAINID_MBER = "domainId";
public static final String DOMAIN_MBER = "domain";
public static final String RANGEID_MBER = "rangeId";
public static final String RANGE_MBER = "range";
public static final String PROPERTYID_MBER = "propertyId";
public static final String PROPERTY_MBER = "property";
public static final String QUALIFIER_MBER = "qualifier";
public static final String DOMAINORIENTED_MBER = "domainOriented";
/**
* Serialize an element named name, with the indicated attributes
* and value.
* @param name is the element name
* @param attributes are the attributes...serialize is free to add more.
* @param value is the value
* @param context is the SerializationContext
*/
public void serialize(QName name, Attributes attributes,
Object value, SerializationContext context)
throws IOException
{
if (!(value instanceof ObjectProperty ))
throw new IOException("Can't serialize a " + value.getClass().getName() + " with a EshipRetroObjectPropertySerializer.");
ObjectProperty e2e = (ObjectProperty)value;
context.startElement(name, attributes);
//context.serialize(new QName("", ENTS2ENTSID_MBER), null, e2e.getEnts2entsId());
//context.serialize(new QName("", DOMAINID_MBER), null, e2e.getDomainId());
//context.serialize(new QName("", DOMAIN_MBER), null, e2e.getDomain());
context.serialize(new QName("", "URI" ), null, e2e.getURI());
context.serialize(new QName("", "domainPublic"), null, e2e.getDomainPublic());
context.serialize(new QName("", "domainSide" ), null, e2e.getDomainSidePhasedOut());
List stmts = e2e.getObjectPropertyStatements();
context.serialize(new QName("", "ents2Ents" ), null, stmts);
context.endElement();
}
public String getMechanismType() { return Constants.AXIS_SAX; }
public Element writeSchema(Class javaType, Types types) throws Exception {
return null;
}
}

View file

@ -1,34 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webservices.serializers;
import java.util.Iterator;
import java.util.Vector;
import javax.xml.rpc.encoding.Serializer;
import org.apache.axis.Constants;
import org.apache.axis.encoding.SerializerFactory;
public class TabSerFactory implements SerializerFactory{
private TabSerializer ts;
private Vector mechanisms;
public TabSerFactory() {
}
public javax.xml.rpc.encoding.Serializer getSerializerAs(String mechanismType) {
if( ts == null )
ts = new TabSerializer();
return ts;
}
public Iterator getSupportedMechanismTypes() {
if (mechanisms == null) {
mechanisms = new Vector();
mechanisms.add(Constants.AXIS_SAX);
}
return mechanisms.iterator();
}
}

View file

@ -1,74 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webservices.serializers;
import java.io.IOException;
import java.util.Collection;
import javax.xml.namespace.QName;
import org.apache.axis.Constants;
import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.encoding.Serializer;
import org.apache.axis.wsdl.fromJava.Types;
import org.w3c.dom.Element;
import org.xml.sax.Attributes;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
public class TabSerializer implements Serializer{
//@Override
public void serialize(QName name, Attributes attributes,
Object value, SerializationContext context)
throws IOException {
if (!(value instanceof Tab))
throw new IOException("Can't serialize a " + value.getClass().getName()
+ " with a TabSerializer.");
Tab tab = (Tab)value;
context.startElement(name, attributes);
context.serialize(new QName("", "id"), null, tab.getTabId() );
context.serialize(new QName("", "title"), null, tab.getTitle());
context.serialize(new QName("", "description"), null, tab.getDescription());
context.serialize(new QName("", "moreTag"), null, tab.getMoreTag());
// context.serialize(new QName("", VCLASS_MBER), null, ent.getVClass());
// context.serialize(new QName("", URL_MBER), null, ent.getUrl());
// context.serialize(new QName("", DESCRIPTION_MBER), null, ent.getDescription());
// context.serialize(new QName("", SUNRISE_MBER), null, ent.getSunrise());
// context.serialize(new QName("", SUNSET_MBER), null, ent.getSunset());
// context.serialize(new QName("", TIMEKEY_MBER), null, ent.getTimekey());
// context.serialize(new QName("", IMAGEFILE_MBER), null, ent.getImageFile());
// context.serialize(new QName("", ANCHOR_MBER), null, ent.getAnchor());
// context.serialize(new QName("", BLURB_MBER), null, ent.getBlurb());
// context.serialize(new QName("", IMAGETHUMB_MBER), null, ent.getImageThumb());
// context.serialize(new QName("", CITATION_MBER), null, ent.getCitation());
// context.serialize(new QName("", STATUS_MBER), null, ent.getStatus());
Collection<Individual> ents = tab.getRelatedEntities();
if( ents != null ){
for(Individual ent : ents ){
ent.setHiddenFromDisplayBelowRoleLevel(null);
ent.setProhibitedFromUpdateBelowRoleLevel(null);
}
}
context.serialize(new QName("", "relatedEntities"), null, ents);
context.endElement();
}
//@Override
public Element writeSchema(Class arg0, Types arg1) throws Exception {
return null;
}
//@Override
public String getMechanismType() { return Constants.AXIS_SAX; }
}