--- /dev/null
+package org.collectionspace.services.common;\r
+\r
+import org.collectionspace.services.common.authorityref.AuthorityRefList;\r
+import org.collectionspace.services.common.context.MultipartServiceContextImpl;\r
+import org.collectionspace.services.common.context.ServiceBindingUtils;\r
+import org.collectionspace.services.common.context.ServiceContext;\r
+import org.collectionspace.services.common.document.DocumentFilter;\r
+import org.collectionspace.services.common.document.DocumentHandler;\r
+import org.collectionspace.services.common.document.DocumentNotFoundException;\r
+import org.collectionspace.services.common.document.DocumentWrapper;\r
+import org.collectionspace.services.common.query.IQueryManager;\r
+import org.collectionspace.services.common.query.QueryManager;\r
+import org.collectionspace.services.common.security.UnauthorizedException;\r
+import org.collectionspace.services.jaxb.AbstractCommonList;\r
+import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler;\r
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;\r
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;\r
+import org.jboss.resteasy.util.HttpResponseCodes;\r
+import org.nuxeo.ecm.core.api.DocumentModel;\r
+\r
+import javax.ws.rs.*;\r
+import javax.ws.rs.core.*;\r
+import java.util.List;\r
+\r
+/**\r
+ * $LastChangedRevision: $\r
+ * $LastChangedDate: $\r
+ * Author: laramie\r
+ */\r
+public abstract class ResourceBase\r
+extends AbstractMultiPartCollectionSpaceResourceImpl {\r
+\r
+ public static final String CREATE = "create";\r
+ public static final String READ = "get";\r
+ public static final String UPDATE = "update";\r
+ public static final String DELETE = "delete";\r
+ public static final String LIST = "list";\r
+\r
+ public void ensureCSID(String csid, String crudType) throws WebApplicationException {\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug(crudType+" for "+getClass().getName()+" with csid=" + csid);\r
+ }\r
+ if (csid == null || "".equals(csid)) {\r
+ logger.error(crudType+" for " + getClass().getName() + " missing csid!");\r
+ Response response = Response.status(Response.Status.BAD_REQUEST)\r
+ .entity("update failed on " + getClass().getName() + " csid=" + csid)\r
+ .type("text/plain")\r
+ .build();\r
+ throw new WebApplicationException(response);\r
+ }\r
+ }\r
+\r
+ protected WebApplicationException bigReThrow(Exception e, String serviceMsg)\r
+ throws WebApplicationException {\r
+ return bigReThrow(e, serviceMsg, "");\r
+ }\r
+\r
+ protected WebApplicationException bigReThrow(Exception e, String serviceMsg, String csid)\r
+ throws WebApplicationException {\r
+ Response response;\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug(getClass().getName(), e);\r
+ }\r
+ if (e instanceof UnauthorizedException) {\r
+ response = Response.status(Response.Status.UNAUTHORIZED)\r
+ .entity(serviceMsg + e.getMessage())\r
+ .type("text/plain")\r
+ .build();\r
+ return new WebApplicationException(response);\r
+ } else if (e instanceof DocumentNotFoundException) {\r
+ response = Response.status(Response.Status.NOT_FOUND)\r
+ .entity(serviceMsg + " on "+getClass().getName()+" csid=" + csid)\r
+ .type("text/plain")\r
+ .build();\r
+ return new WebApplicationException(response);\r
+ } else { //e is now instanceof Exception\r
+ response = Response.status(Response.Status.INTERNAL_SERVER_ERROR)\r
+ .entity(serviceMsg)\r
+ .type("text/plain")\r
+ .build();\r
+ return new WebApplicationException(response);\r
+ }\r
+ }\r
+\r
+ //======================= CREATE ====================================================\r
+\r
+ @POST\r
+ public Response create(MultipartInput input) {\r
+ try {\r
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(input);\r
+ DocumentHandler handler = createDocumentHandler(ctx);\r
+ UriBuilder path = UriBuilder.fromResource(this.getClass());\r
+ return create(input, ctx, handler, path); //==> CALL implementation method, which subclasses may override.\r
+ } catch (Exception e) {\r
+ throw bigReThrow(e, ServiceMessages.CREATE_FAILED);\r
+ }\r
+ }\r
+\r
+ /** Subclasses may override this overload, which gets called from @see #create(MultipartInput) */\r
+ protected Response create(MultipartInput input,\r
+ ServiceContext<MultipartInput, MultipartOutput> ctx,\r
+ DocumentHandler handler,\r
+ UriBuilder path)\r
+ throws Exception {\r
+ String csid = getRepositoryClient(ctx).create(ctx, handler);\r
+ path.path("" + csid);\r
+ Response response = Response.created(path.build()).build();\r
+ return response;\r
+ }\r
+\r
+ //======================= UPDATE ====================================================\r
+\r
+ @PUT\r
+ @Path("{csid}")\r
+ public MultipartOutput update(@PathParam("csid") String csid, MultipartInput theUpdate) {\r
+ ensureCSID(csid, UPDATE);\r
+ try {\r
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(theUpdate);\r
+ DocumentHandler handler = createDocumentHandler(ctx);\r
+ return update(csid, theUpdate, ctx, handler); //==> CALL implementation method, which subclasses may override.\r
+ } catch (Exception e) {\r
+ throw bigReThrow(e, ServiceMessages.UPDATE_FAILED, csid);\r
+ }\r
+ }\r
+\r
+ /** Subclasses may override this overload, which gets called from #udpate(String,MultipartInput) */\r
+ protected MultipartOutput update(String csid,\r
+ MultipartInput theUpdate,\r
+ ServiceContext<MultipartInput, MultipartOutput> ctx,\r
+ DocumentHandler handler)\r
+ throws Exception {\r
+ getRepositoryClient(ctx).update(ctx, csid, handler);\r
+ return (MultipartOutput) ctx.getOutput();\r
+ }\r
+\r
+ //======================= DELETE ====================================================\r
+\r
+ @DELETE\r
+ @Path("{csid}")\r
+ public Response delete(@PathParam("csid") String csid) {\r
+ ensureCSID(csid, DELETE);\r
+ try {\r
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext();\r
+ return delete(csid, ctx); //==> CALL implementation method, which subclasses may override.\r
+ } catch (Exception e) {\r
+ throw bigReThrow(e, ServiceMessages.DELETE_FAILED, csid);\r
+ }\r
+ }\r
+\r
+ /** subclasses may override this method, which is called from #delete(String)\r
+ * which handles setup of ServiceContext, and does Exception handling. */\r
+ protected Response delete(String csid, ServiceContext<MultipartInput, MultipartOutput> ctx)\r
+ throws Exception {\r
+ getRepositoryClient(ctx).delete(ctx, csid);\r
+ return Response.status(HttpResponseCodes.SC_OK).build(); \r
+ }\r
+\r
+\r
+ //======================= GET ====================================================\r
+\r
+ @GET\r
+ @Path("{csid}")\r
+ public MultipartOutput get(@PathParam("csid") String csid) {\r
+ ensureCSID(csid, READ);\r
+ try {\r
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext();\r
+ DocumentHandler handler = createDocumentHandler(ctx);\r
+ MultipartOutput result = get(csid, ctx, handler);// ==> CALL implementation method, which subclasses may override.\r
+ if (result == null) {\r
+ Response response = Response.status(Response.Status.NOT_FOUND).entity(\r
+ ServiceMessages.READ_FAILED + ServiceMessages.resourceNotFoundMsg(csid)).type("text/plain").build();\r
+ throw new WebApplicationException(response);\r
+ }\r
+ return result;\r
+ } catch (Exception e) {\r
+ throw bigReThrow(e, ServiceMessages.READ_FAILED, csid);\r
+ }\r
+ }\r
+\r
+ /** subclasses may override this method, which is called from #get(String)\r
+ * which handles setup of ServiceContext and DocumentHandler, and Exception handling.*/\r
+ public MultipartOutput get(String csid,\r
+ ServiceContext<MultipartInput, MultipartOutput> ctx,\r
+ DocumentHandler handler)\r
+ throws Exception {\r
+ getRepositoryClient(ctx).get(ctx, csid, handler);\r
+ return (MultipartOutput) ctx.getOutput();\r
+ }\r
+\r
+ //======================= GET without csid. List, search, etc. =====================================\r
+\r
+ @GET\r
+ @Produces("application/xml")\r
+ public AbstractCommonList getList (@Context UriInfo ui,\r
+ @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords) {\r
+ MultivaluedMap<String, String> queryParams = ui.getQueryParameters();\r
+ if (keywords != null) {\r
+ return search(queryParams, keywords);\r
+ } else {\r
+ return getList(queryParams);\r
+ }\r
+ }\r
+\r
+ protected AbstractCommonList getList(MultivaluedMap<String, String> queryParams) {\r
+ try {\r
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);\r
+ DocumentHandler handler = createDocumentHandler(ctx);\r
+ getRepositoryClient(ctx).getFiltered(ctx, handler);\r
+ return (AbstractCommonList)handler.getCommonPartList();\r
+ } catch (Exception e) {\r
+ throw bigReThrow(e, ServiceMessages.LIST_FAILED);\r
+ }\r
+ }\r
+\r
+\r
+ protected AbstractCommonList search(MultivaluedMap<String, String> queryParams, String keywords) {\r
+ try {\r
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);\r
+ DocumentHandler handler = createDocumentHandler(ctx);\r
+ // perform a keyword search\r
+ if (keywords != null && !keywords.isEmpty()) {\r
+ String whereClause = QueryManager.createWhereClauseFromKeywords(keywords);\r
+ DocumentFilter documentFilter = handler.getDocumentFilter();\r
+ documentFilter.setWhereClause(whereClause);\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug("The WHERE clause is: " + documentFilter.getWhereClause());\r
+ }\r
+ }\r
+ getRepositoryClient(ctx).getFiltered(ctx, handler);\r
+ return (AbstractCommonList) handler.getCommonPartList();\r
+ } catch (Exception e) {\r
+ throw bigReThrow(e, ServiceMessages.SEARCH_FAILED);\r
+ }\r
+ }\r
+\r
+ @Deprecated\r
+ public AbstractCommonList getList(List<String> csidList) {\r
+ try {\r
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext();\r
+ DocumentHandler handler = createDocumentHandler(ctx);\r
+ getRepositoryClient(ctx).get(ctx, csidList, handler);\r
+ return (AbstractCommonList)handler.getCommonPartList();\r
+ } catch (Exception e) {\r
+ throw bigReThrow(e, ServiceMessages.LIST_FAILED);\r
+ }\r
+ }\r
+\r
+ //======================== GET : getAuthorityRefs ========================================\r
+\r
+ @GET\r
+ @Path("{csid}/authorityrefs")\r
+ @Produces("application/xml")\r
+ public AuthorityRefList getAuthorityRefs(\r
+ @PathParam("csid") String csid,\r
+ @Context UriInfo ui) {\r
+ AuthorityRefList authRefList = null;\r
+ try {\r
+ MultivaluedMap<String, String> queryParams = ui.getQueryParameters();\r
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);\r
+ DocumentWrapper<DocumentModel> docWrapper = getRepositoryClient(ctx).getDoc(ctx, csid);\r
+ DocumentModelHandler<MultipartInput, MultipartOutput> handler = (DocumentModelHandler<MultipartInput, MultipartOutput>)createDocumentHandler(ctx);\r
+ List<String> authRefFields =\r
+ ((MultipartServiceContextImpl) ctx).getCommonPartPropertyValues(\r
+ ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES);\r
+ authRefList = handler.getAuthorityRefs(docWrapper, authRefFields);\r
+ } catch (Exception e) {\r
+ throw bigReThrow(e, ServiceMessages.AUTH_REFS_FAILED, csid);\r
+ }\r
+ return authRefList;\r
+ }\r
+ \r
+}\r
--- /dev/null
+package org.collectionspace.services.common;\r
+\r
+\r
+import java.io.UnsupportedEncodingException;\r
+import java.net.URLDecoder;\r
+import java.net.URLEncoder;\r
+import java.util.Enumeration;\r
+\r
+import javax.servlet.http.Cookie;\r
+import javax.servlet.http.HttpServletRequest;\r
+import javax.servlet.http.HttpServletResponse;\r
+\r
+public class ServletTools {\r
+\r
+ public final static int BROWSER_NOT_SET = -1;\r
+ public final static int BROWSER_UNKNOWN = 0;\r
+ public final static int BROWSER_IE4 = 1;\r
+ public final static int BROWSER_NETSCAPE_COMPATIBLE = 20;\r
+ public final static int BROWSER_NETSCAPE_4 = 21;\r
+ public final static int BROWSER_NETSCAPE_5 = 22;\r
+ public final static int BROWSER_NETSCAPE_6 = 23;\r
+ public final static int BROWSER_IE = 24;\r
+ public final static int BROWSER_DYNAMIDE_TEXT = 50;\r
+\r
+ public final static String BROWSER_STRING_UNKNOWN = "*";\r
+ public final static String BROWSER_STRING_IE = "IE";\r
+ public final static String BROWSER_STRING_NETSCAPE_COMPATIBLE = "NS";\r
+\r
+ public final static String getBrowserStringFromID(int id){\r
+ switch ( id ) {\r
+ case BROWSER_UNKNOWN : return BROWSER_STRING_UNKNOWN;\r
+ case BROWSER_IE : return BROWSER_STRING_IE;\r
+ case BROWSER_NETSCAPE_COMPATIBLE : return BROWSER_STRING_NETSCAPE_COMPATIBLE;\r
+ default: return BROWSER_STRING_UNKNOWN;\r
+ }\r
+ }\r
+\r
+ /** Different from ServletRequest.getParameter in that this function will never return a null, always and empty string if param not found.\r
+ */\r
+ public static String getParameterValue(HttpServletRequest request, String paramName){\r
+ if (request == null){\r
+ return "";\r
+ }\r
+ String value = request.getParameter(paramName);\r
+ value = (value == null) ? "" : value;\r
+ return value;\r
+ }\r
+\r
+ public static String getURL(HttpServletRequest request){\r
+ if (request == null){\r
+ return "";\r
+ }\r
+ String qs = request.getQueryString();\r
+ String qstr = (qs != null && qs.length() > 0)\r
+ ? "?"+qs\r
+ : "";\r
+ return request.getRequestURI()+qstr;\r
+ }\r
+\r
+ public static String getFullURL(HttpServletRequest request){\r
+ return getProtoHostPort(request)+getURL(request);\r
+ }\r
+\r
+ /** @return "http" or "https", without the "://" part.\r
+ */\r
+ public static String getProto(HttpServletRequest request){\r
+ if (request==null){\r
+ return "";\r
+ }\r
+ String prot = request.getAuthType();\r
+ String protocol = prot != null && prot.equals("SSL") ? "https" : "http";\r
+ return protocol;\r
+ }\r
+\r
+ public static String getProtoHostPort(HttpServletRequest request){\r
+ if (request==null){\r
+ return "";\r
+ }\r
+ String protocol = getProto(request);\r
+ int port = request.getServerPort();\r
+ String portstr;\r
+ if ( protocol.equals("https") ) {\r
+ portstr = (port != 443) ? ":"+port : "";\r
+ } else {\r
+ portstr = (port != 80) ? ":"+port : "";\r
+ }\r
+ return protocol+"://"+request.getServerName()+portstr;\r
+ }\r
+\r
+ public static String getProtoHostPort(java.net.URL url){\r
+ if (url==null){\r
+ return "";\r
+ }\r
+ String protocol = url.getProtocol();\r
+ int port = url.getPort();\r
+ String portstr;\r
+ if ( protocol.equals("https") ) {\r
+ portstr = (port != 443) ? ":"+port : "";\r
+ } else {\r
+ portstr = (port != 80) ? ":"+port : "";\r
+ }\r
+ return protocol+"://"+url.getHost()+portstr;\r
+ }\r
+\r
+ public static String decodeURLString(HttpServletRequest request, String paramName) throws UnsupportedEncodingException{\r
+ if ( request == null ) {\r
+ return "";\r
+ }\r
+ String value = request.getParameter(paramName);\r
+ return decodeURLString(value);\r
+ }\r
+\r
+ public static String decodeURLString(String URLString) throws UnsupportedEncodingException{\r
+ if ( URLString == null ) {\r
+ return "";\r
+ }\r
+ return URLDecoder.decode(URLString, "UTF-8");\r
+ }\r
+\r
+ public static String encodeURLString(String s){\r
+ return URLEncoder.encode(s);\r
+ }\r
+\r
+ public static String dumpRequestInfo(HttpServletRequest request){\r
+ return dumpRequestInfo(request, true, "#FFAD00", true);\r
+ }\r
+\r
+ public static String dumpRequestInfo(HttpServletRequest request, boolean html, String headerColor, boolean dumpHeaders){\r
+ if (request==null){\r
+ return "NULL REQUEST";\r
+ }\r
+ String result;\r
+ if (dumpHeaders){\r
+ result = dumpRequestHeaders(request, html);\r
+ } else {\r
+ result = "URL: " + getFullURL(request);\r
+ }\r
+\r
+ if ( html ) {\r
+ result = result + "\r\n<br />Params: ";\r
+ } else {\r
+ result = result + "\r\nParams: ";\r
+ }\r
+ result = result + dumpRequestParams(request, html, headerColor);\r
+ return result;\r
+ }\r
+\r
+ public static String dumpRequestHeaders(HttpServletRequest request, boolean html){\r
+ if (request==null){\r
+ return "NULL REQUEST";\r
+ }\r
+ String headers = "";\r
+ String nl = html ? "\r\n<br />" : "\r\n";\r
+ for(Enumeration headernames = request.getHeaderNames(); headernames.hasMoreElements();){\r
+ String headername = (String)headernames.nextElement();\r
+ headers += nl + headername+": "+request.getHeader(headername);\r
+ }\r
+ String result;\r
+ if ( html ) {\r
+ result = "<pre>";\r
+ } else {\r
+ result = "";\r
+ }\r
+ result = result + "\r\nHeaders: "+ headers\r
+ +"\r\nmethod: " + request.getMethod()\r
+ +"\r\nProtocol: " + getProto(request)\r
+ +"\r\nURL: " + getFullURL(request);\r
+ //+"\r\nQuery String: " + getQueryString()\r
+ //+"\r\nContent: " + getContent();\r
+ if ( html ) {\r
+ result = result + "</pre>";\r
+ }\r
+ return result;\r
+ }\r
+\r
+ public static String dumpRequestParams(HttpServletRequest request){\r
+ return dumpRequestParams(request, true, "#FFAD00");\r
+ }\r
+ public static String dumpRequestParams(HttpServletRequest request, boolean html, String headerColor){\r
+ if (request==null){\r
+ return "NULL REQUEST";\r
+ }\r
+ StringBuffer result = new StringBuffer();\r
+ if (html) result.append( "<TABLE BORDER='1' cellpadding='0' cellspacing='0'>\n" +\r
+ "<TR BGCOLOR='"+headerColor+"'>\n" +\r
+ "<TH>Parameter Name</TH><TH>Parameter Value(s)</TH></TR>");\r
+ Enumeration paramNames = request.getParameterNames();\r
+ while(paramNames.hasMoreElements()) {\r
+ String paramName = (String)paramNames.nextElement();\r
+\r
+ if (html) result.append("\r\n<TR><TD>" + paramName + "\r\n</TD><TD>");\r
+ else result.append(paramName).append("=");\r
+\r
+ String[] paramValues = request.getParameterValues(paramName);\r
+ if (paramValues.length == 1) {\r
+ String paramValue = paramValues[0];\r
+ if (paramValue.length() == 0){\r
+ if (html) result.append("<I>No Value</I>");\r
+ else result.append("\"\"");\r
+ } else {\r
+ if (html) result.append(paramValue);\r
+ else result.append('\"'+paramValue+'\"');\r
+ }\r
+ } else {\r
+ if (html) result.append("<UL>");\r
+ for(int i=0; i<paramValues.length; i++) {\r
+ if (html) result.append("<LI>" + paramValues[i]+"</LI>");\r
+ else result.append('\"'+paramValues[i]+'\"');\r
+ }\r
+ if (html) result.append("</UL>");\r
+ }\r
+ if (html) result.append("</TD>\r\n</TR>");\r
+ else result.append("\r\n");\r
+ }\r
+ if (html) result.append("</TABLE>");\r
+ return result.toString();\r
+ }\r
+\r
+\r
+\r
+ public static class UserIDPassword {\r
+ public String user_id = "";\r
+ public String password = "";\r
+ }\r
+\r
+ /*\r
+\r
+ public String getUserName(){\r
+ String remoteUserName = getRemoteUser().user_id;\r
+ if (remoteUserName.length() > 0){\r
+ return remoteUserName;\r
+ } else {\r
+ String name = getFieldValue("USER");\r
+ if ( name != null && name.length()>0 ) {\r
+ return name;\r
+ }\r
+ }\r
+ return "";\r
+ }\r
+ */\r
+ public static UserIDPassword getRemoteUser(HttpServletRequest request){\r
+ return getRemoteUser(request.getHeader("Authorization"));\r
+ }\r
+\r
+ protected static UserIDPassword getRemoteUser(String authString){\r
+ UserIDPassword uip = new UserIDPassword();\r
+ try { // Decode and decompose the Authorization headervalue\r
+ if (authString == null){\r
+ return uip;\r
+ }\r
+ authString = authString.substring(6).trim();\r
+ byte mydata[];\r
+ sun.misc.BASE64Decoder base64 = new sun.misc.BASE64Decoder();\r
+ mydata = base64.decodeBuffer(authString);\r
+ String loginInfo = new String(mydata);\r
+ int index = loginInfo.indexOf(":");\r
+ if( index != -1 ){\r
+ uip.password = loginInfo.substring(index +1);\r
+ uip.user_id = loginInfo.substring(0, index);\r
+ }\r
+ } catch(Exception e) {\r
+ //result will have empty user name\r
+ System.out.println("ServletTools.getRemoteUser() failed to obtain Authorization info");\r
+ }\r
+ return uip;\r
+ }\r
+\r
+ public static String browserVersion(HttpServletRequest request){\r
+ String agent = request.getHeader("User-Agent");\r
+ //Examples:\r
+ //curl/7.5.1\r
+ //Mozilla/4.0\r
+ //Mozilla/4.08 [en] (Win95; U ;Nav)\r
+ //Mozilla/4.0 (compatible; MSIE 5.01; Windows NT; FMRCo cfg. 5.01.2.1a)\r
+ //Mozilla/4.0 (compatible; MSIE 5.01; Windows NT; FMRCo cfg. 5.01.2.1a)\r
+ if ( agent == null ) {\r
+ return "null";//don't just return "" since this value may be used in a Tcl eval, and it would then disappear.\r
+ }\r
+ int start, stop;\r
+ if ( agent.indexOf("MSIE ") > -1 ) {\r
+ start = agent.indexOf("MSIE ");\r
+ stop = agent.indexOf(";", start);\r
+ stop = stop > -1 ? stop : agent.length(); //safety\r
+ return agent.substring(start+5, stop).trim();\r
+ } else {\r
+ start = agent.indexOf("/");\r
+ stop = agent.indexOf(" ");\r
+ stop = stop > -1 ? stop : agent.length(); //for JSSE, there is no space: User-Agent: Java1.3.0_02\r
+ return agent.substring(start+1, stop).trim();\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Mozilla/4.79 [en] (Windows NT 5.0; U)\r
+ * Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6\r
+ * Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1\r
+ * Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)\r
+ */\r
+ public static int findBrowserID(HttpServletRequest request){\r
+ String browserString = request.getHeader("User-Agent");\r
+ if (browserString == null)\r
+ return BROWSER_UNKNOWN;\r
+ if (browserString.indexOf("MSIE") > -1)\r
+ return BROWSER_IE4;\r
+ int iMozilla = browserString.indexOf("Mozilla");\r
+ if (iMozilla > -1){\r
+ String ver = browserString.substring(iMozilla + ("Mozilla/".length()) );\r
+ int iSpace = ver.indexOf(" ");\r
+ if (iSpace>-1){\r
+ ver = ver.substring(0, iSpace);\r
+ }\r
+ try {\r
+ Double majorminor = new Double(ver);\r
+ if (majorminor.longValue()==4){\r
+ return BROWSER_NETSCAPE_4;\r
+ }\r
+ if (majorminor.longValue()==5){\r
+ return BROWSER_NETSCAPE_5;\r
+ }\r
+ if (majorminor.longValue()==6){\r
+ return BROWSER_NETSCAPE_6;\r
+ }\r
+ } catch (Exception e) {\r
+ System.out.println("ERROR: silent after catching error converting browser minor version."+browserString);\r
+ return BROWSER_NETSCAPE_COMPATIBLE;\r
+ }\r
+ return BROWSER_NETSCAPE_COMPATIBLE;\r
+ }\r
+ return BROWSER_UNKNOWN;\r
+ }\r
+\r
+ public static boolean isBrowserIE(int bid){\r
+ return (bid == BROWSER_IE4 || bid == BROWSER_IE) ? true : false ;\r
+ }\r
+\r
+ public static boolean isBrowserNS4x(int bid){\r
+ return (bid == BROWSER_NETSCAPE_4) ;\r
+ }\r
+\r
+ public static String getCookieValue(HttpServletRequest request, String name ){\r
+ Cookie result = findCookie(request, name);\r
+ if ( result != null ) {\r
+ return result.getValue();\r
+ }\r
+ return "";\r
+ }\r
+\r
+ public static Cookie findCookie(HttpServletRequest request, String name ){\r
+ if (request == null || name == null) {\r
+ return null;\r
+ }\r
+ Cookie [] cookies = request.getCookies();\r
+ if ( cookies == null ) {\r
+ return null;\r
+ }\r
+ int cookies_len = cookies.length;\r
+ for (int i=0; i < cookies_len; i++) {\r
+ Cookie cookie = cookies[i];\r
+ if (cookie != null && name.equals(cookie.getName())){\r
+ return cookie;\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+ public static Cookie setCookie(HttpServletResponse response, String name, String value){\r
+ return setCookie(response, name, value, "/", 365*24*60*60);\r
+ }\r
+\r
+ public static Cookie setCookie(HttpServletResponse response, String name, String value, String path, int maxAge){\r
+ Cookie cookie = new javax.servlet.http.Cookie(name, value);\r
+ cookie.setMaxAge(maxAge);\r
+ cookie.setPath(path);\r
+ response.addCookie(cookie);\r
+ return cookie;\r
+ }\r
+\r
+\r
+\r
+}\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>org.collectionspace.services.objectexit</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>org.collectionspace.services.objectexit.3rdparty</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+
+<project name="objectexit.3rdparty" default="package" basedir=".">
+ <description>
+ objectexit service 3rdparty
+ </description>
+ <!-- set global properties for this build -->
+ <property name="services.trunk" value="../../.."/>
+ <!-- environment should be declared before reading build.properties -->
+ <property environment="env" />
+ <property file="${services.trunk}/build.properties" />
+ <property name="mvn.opts" value="" />
+ <property name="src" location="src"/>
+
+ <condition property="osfamily-unix">
+ <os family="unix" />
+ </condition>
+ <condition property="osfamily-windows">
+ <os family="windows" />
+ </condition>
+
+ <target name="init" >
+ <!-- Create the time stamp -->
+ <tstamp/>
+ </target>
+
+ <target name="package" depends="package-unix,package-windows"
+ description="Package CollectionSpace Services" />
+ <target name="package-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="package-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="install" depends="install-unix,install-windows"
+ description="Install" />
+ <target name="install-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="install-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="clean" depends="clean-unix,clean-windows"
+ description="Delete target directories" >
+ <delete dir="${build}"/>
+ </target>
+ <target name="clean-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="clean-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="test" depends="test-unix,test-windows" description="Run tests" />
+ <target name="test-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="test-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="deploy" depends="install"
+ description="deploy objectexit in ${jboss.server.nuxeo}">
+ <ant antfile="nuxeo-platform-cs-objectexit/build.xml" target="deploy" inheritall="false"/>
+ </target>
+
+ <target name="undeploy"
+ description="undeploy objectexit from ${jboss.server.nuxeo}">
+ <ant antfile="nuxeo-platform-cs-objectexit/build.xml" target="undeploy" inheritall="false"/>
+ </target>
+
+ <target name="dist"
+ description="generate distribution for objectexit" depends="package">
+ <ant antfile="nuxeo-platform-cs-objectexit/build.xml" target="dist" inheritall="false"/>
+ </target>
+
+
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>org.collectionspace.services.objectexit.3rdparty.nuxeo</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+
+<project name="nuxeo-platform-cs-objectexit" default="package" basedir=".">
+ <description>
+ objectexit nuxeo document type
+ </description>
+ <!-- set global properties for this build -->
+ <property name="services.trunk" value="../../../.."/>
+ <!-- environment should be declared before reading build.properties -->
+ <property environment="env" />
+ <property file="${services.trunk}/build.properties" />
+ <property name="mvn.opts" value="" />
+ <property name="src" location="src"/>
+ <property name="nuxeo.objectexit.jar"
+ value="org.collectionspace.services.objectexit.3rdparty.nuxeo-${cspace.release}.jar"/>
+ <property name="nuxeo.objectexit.jars.all"
+ value="org.collectionspace.services.objectexit.3rdparty.nuxeo-*.jar"/>
+
+ <condition property="osfamily-unix">
+ <os family="unix" />
+ </condition>
+ <condition property="osfamily-windows">
+ <os family="windows" />
+ </condition>
+
+ <target name="init" >
+ <!-- Create the time stamp -->
+ <tstamp/>
+ </target>
+
+ <target name="package" depends="package-unix,package-windows"
+ description="Package CollectionSpace Services" />
+ <target name="package-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="package-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="install" depends="install-unix,install-windows"
+ description="Install" />
+ <target name="install-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="install-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="clean" depends="clean-unix,clean-windows"
+ description="Delete target directories" >
+ <delete dir="${build}"/>
+ </target>
+ <target name="clean-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="clean-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="test" depends="test-unix,test-windows" description="Run tests" />
+ <target name="test-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="test-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="deploy" depends="install"
+ description="deploy objectexit doctype in ${jboss.server.nuxeo}">
+ <copy file="${basedir}/target/${nuxeo.objectexit.jar}"
+ todir="${jboss.deploy.nuxeo.plugins}"/>
+ </target>
+
+ <target name="undeploy"
+ description="undeploy objectexit doctype from ${jboss.server.nuxeo}">
+ <delete>
+ <fileset dir="${jboss.deploy.nuxeo.plugins}">
+ <include name="${nuxeo.objectexit.jars.all}"/>
+ </fileset>
+ <!-- Legacy deployment location through release 0.6 -->
+ <fileset dir="${jboss.deploy.nuxeo.system}">
+ <include name="${nuxeo.objectexit.jars.all}"/>
+ </fileset>
+ </delete>
+ </target>
+
+
+ <target name="dist"
+ description="generate distribution for objectexit doctype" depends="package">
+ <copy todir="${services.trunk}/${dist.deploy.nuxeo.plugins}">
+ <fileset file="${basedir}/target/${nuxeo.objectexit.jar}"/>
+ </copy>
+ </target>
+
+</project>
+
--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.objectexit.3rdparty</artifactId>
+ <version>0.9-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.objectexit.3rdparty.nuxeo</artifactId>
+ <name>services.objectexit.3rdparty.nuxeo</name>
+ <packaging>jar</packaging>
+ <description>
+ ObjectExit Nuxeo Document Type
+ </description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile> src/main/resources/META-INF/MANIFEST.MF </manifestFile>
+ <manifestEntries>
+ <Bundle-Version>${eclipseVersion}</Bundle-Version>
+ <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
--- /dev/null
+Manifest-Version: 1.0 \r
+Bundle-ManifestVersion: 1 \r
+Bundle-Name: NuxeoCS\r
+Bundle-SymbolicName: org.collectionspace.objectexit;singleton:=true \r
+Bundle-Version: 1.0.0\r
+Bundle-Localization: plugin\r
+Bundle-Vendor: Nuxeo \r
+Require-Bundle: org.nuxeo.runtime, \r
+ org.nuxeo.ecm.core.api, \r
+ org.nuxeo.ecm.core,\r
+ org.nuxeo.ecm.core.api,\r
+ org.nuxeo.ecm.platform.types.api,\r
+ org.nuxeo.ecm.platform.versioning.api,\r
+ org.nuxeo.ecm.platform.ui,\r
+ org.nuxeo.ecm.platform.forms.layout.client,\r
+ org.nuxeo.ecm.platform.publishing.api,\r
+ org.nuxeo.ecm.platform.ws \r
+Provide-Package: org.collectionspace.objectexit\r
+Nuxeo-Component: OSGI-INF/core-types-contrib.xml,\r
+ OSGI-INF/ecm-types-contrib.xml,\r
+ OSGI-INF/layouts-contrib.xml\r
+\r
--- /dev/null
+<?xml version="1.0"?>
+<component name="org.collectionspace.objectexit.coreTypes">
+ <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
+ <schema name="objectexit_common" prefix="objectexit_common" src="schemas/objectexit_common.xsd"/>
+ </extension>
+
+ <extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
+ <doctype name="ObjectExit" extends="Document">
+ <schema name="common"/>
+ <schema name="dublincore"/>
+ <schema name="collectionspace_core"/>
+ <schema name="objectexit_common"/>
+ </doctype>
+ </extension>
+</component>
--- /dev/null
+<?xml version="1.0"?>
+<fragment>
+
+ <extension target="application#MODULE">
+ <module>
+ <ejb>${bundle.fileName}</ejb>
+ </module>
+
+ <module>
+ <web>
+ <web-uri>nuxeo.war</web-uri>
+ <context-root>/nuxeo</context-root>
+ </web>
+ </module>
+ </extension>
+
+ <!-- uncomment that to enable tomcat based auth
+ <extension target="web#LOGIN-CONFIG">
+ <login-config>
+ <auth-method>FORM</auth-method>
+ <realm-name>nuxeo.ecm</realm-name>
+ <form-login-config>
+ <form-login-page>/login.jsp</form-login-page>
+ <form-error-page>/login.jsp?loginFailed=true</form-error-page>
+ </form-login-config>
+ </login-config>
+ </extension>
+ -->
+
+ <extension target="web#FILTER-MAPPING">
+
+ <!-- Seam Context Filter is declared in org.nuxeo.ecm.platform.ui.web
+ deployment fragment -->
+
+ <filter-mapping>
+ <filter-name>Seam Context Filter</filter-name>
+ <url-pattern>/ws/FileManageWS</url-pattern>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>Seam Context Filter</filter-name>
+ <url-pattern>/DocumentManagerWS</url-pattern>
+ </filter-mapping>
+ </extension>
+
+ <extension target="web#SERVLET">
+ </extension>
+
+ <extension target="web#SERVLET-MAPPING">
+ </extension>
+
+ <extension target="pages#PAGES">
+ <!-- This calls a method which load the Workspace logo -->
+ <page view-id="/showLogo.xhtml" action="#{logoHelper.getLogo}"/>
+
+ <!-- Bind URL to the Document URL resolver-->
+ <page view-id="/getDocument.xhtml"
+ action="#{navigationContext.navigateToURL}">
+ </page>
+
+ <page view-id="/nxliveedit.xhtml" action="#{liveEditHelper.getBootstrap()}"/>
+
+ <!-- Bind URL to the Parallele conversation Document URL resolver-->
+ <page view-id="/parallele.xhtml"
+ action="#{paralleleNavigationHelper.navigateToURL}">
+ </page>
+
+ <!-- Post login and 'home' view handler -->
+ <page view-id="/nxstartup.xhtml"
+ action="#{startupHelper.initDomainAndFindStartupPage('Default domain', 'view')}"/>
+
+ <!-- To redirect to the user dashboard instead, use instead:
+
+ <page view-id="/nxstartup.xhtml"
+ action="#{startupHelper.initDomainAndFindStartupPage('Default domain', 'user_dashboard')}" />
+ -->
+
+ <!-- config for workspace management
+ = give a description for each viewId
+ -->
+
+ <page view-id="/view_domains.xhtml">
+ #{currentServerLocation.name}/#{currentTabAction.label}
+ </page>
+
+ <page view-id="/select_document_type.faces.xhtml">
+ Create new document in #{currentDocument.name}
+ </page>
+
+ <page view-id="/create_document.faces.xhtml">
+ Create new document in #{currentDocument.name}
+ </page>
+
+ <page view-id="/user_dashboard.xhtml">
+ breadcrumb=command.user_dashboard
+ </page>
+
+ <page view-id="/view_users.xhtml">
+ breadcrumb=command.manageMembers
+ </page>
+
+ <page view-id="/view_many_users.xhtml">
+ breadcrumb=command.manageMembers
+ </page>
+
+ <page view-id="/view_vocabularies.xhtml">
+ breadcrumb=title.vocabularies
+ </page>
+
+ <page view-id="/search/search_form.xhtml">
+ breadcrumb=command.advancedSearch
+ </page>
+ </extension>
+
+ <extension target="faces-config#APPLICATION">
+ <locale-config>
+ <default-locale>en</default-locale>
+ <supported-locale>en_GB</supported-locale>
+ <supported-locale>en_US</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <supported-locale>de</supported-locale>
+ <supported-locale>es</supported-locale>
+ <supported-locale>it</supported-locale>
+ <supported-locale>ar</supported-locale>
+ <supported-locale>ru</supported-locale>
+ <supported-locale>ja</supported-locale>
+ <supported-locale>vn</supported-locale>
+ </locale-config>
+
+ <message-bundle>messages</message-bundle>
+ </extension>
+
+ <extension target="components#PAGEFLOW">
+ <value>config/addWorkspace.jpdl.xml</value>
+ </extension>
+
+ <extension target="faces-config#NAVIGATION">
+ <!-- generic pages -->
+ <navigation-case>
+ <from-outcome>generic_error_page</from-outcome>
+ <to-view-id>/generic_error_page.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>generic_message_page</from-outcome>
+ <to-view-id>/generic_message_page.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>home</from-outcome>
+ <to-view-id>/nxstartup.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>user_login</from-outcome>
+ <to-view-id>/login.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>user_logout</from-outcome>
+ <to-view-id>/logout.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_servers</from-outcome>
+ <to-view-id>/view_servers.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- pages for document actions -->
+
+ <navigation-case>
+ <from-outcome>view_domains</from-outcome>
+ <to-view-id>/view_domains.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>select_document_type</from-outcome>
+ <to-view-id>/select_document_type.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>create_document</from-outcome>
+ <to-view-id>/create_document.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>edit_document</from-outcome>
+ <to-view-id>/edit_document.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_documents</from-outcome>
+ <to-view-id>/view_documents.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>create_file</from-outcome>
+ <to-view-id>/create_file.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>create_workspace_wizard</from-outcome>
+ <to-view-id>/createWorkspaceWizard.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>send_email</from-outcome>
+ <to-view-id>/document_email.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- AT: BBB, use view_documents instead -->
+ <navigation-case>
+ <from-outcome>view_workspaces</from-outcome>
+ <to-view-id>/view_workspaces.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- AT: BBB, use create_document instead -->
+ <navigation-case>
+ <from-outcome>create_domain</from-outcome>
+ <to-view-id>/create_domain.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- AT: BBB, use edit_document instead -->
+ <navigation-case>
+ <from-outcome>edit_domain</from-outcome>
+ <to-view-id>/edit_domain.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- AT: BBB, use create_document instead -->
+ <navigation-case>
+ <from-outcome>create_workspace</from-outcome>
+ <to-view-id>/create_workspace.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- AT: BBB, use edit_document instead -->
+ <navigation-case>
+ <from-outcome>edit_workspace</from-outcome>
+ <to-view-id>/edit_workspace.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- users ang groups -->
+
+ <navigation-case>
+ <from-outcome>members_management</from-outcome>
+ <to-view-id>/members_management.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_users</from-outcome>
+ <to-view-id>/view_users.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_many_users</from-outcome>
+ <to-view-id>/view_many_users.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>edit_user</from-outcome>
+ <to-view-id>/edit_user.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>edit_user_password</from-outcome>
+ <to-view-id>/edit_user_password.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_user</from-outcome>
+ <to-view-id>/view_user.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>create_user</from-outcome>
+ <to-view-id>/create_user.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_groups</from-outcome>
+ <to-view-id>/view_groups.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_group</from-outcome>
+ <to-view-id>/view_group.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>edit_group</from-outcome>
+ <to-view-id>/edit_group.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>create_group</from-outcome>
+ <to-view-id>/create_group.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_vocabularies</from-outcome>
+ <to-view-id>/view_vocabularies.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_vocabulary</from-outcome>
+ <to-view-id>/view_vocabulary.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- search -->
+
+ <navigation-case>
+ <from-outcome>search_form</from-outcome>
+ <to-view-id>/search/search_form.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>search_results_nxql</from-outcome>
+ <to-view-id>/search/search_results_nxql.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>search_results_advanced</from-outcome>
+ <to-view-id>
+ /search/search_results_advanced.xhtml
+ </to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>search_results_simple</from-outcome>
+ <to-view-id>/search/search_results_simple.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- miscellaneaous -->
+
+ <navigation-case>
+ <from-outcome>clipboard</from-outcome>
+ <to-view-id>/incl/clipboard.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>user_dashboard</from-outcome>
+ <to-view-id>/user_dashboard.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>select_workspace_template</from-outcome>
+ <to-view-id>/select_workspace_template.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>pdf_generation_error</from-outcome>
+ <to-view-id>/pdf_generation_error.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>mass_edit</from-outcome>
+ <to-view-id>/massedit_documents.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>mass_edit_confirm</from-outcome>
+ <to-view-id>/massedit_documents_preview.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </extension>
+
+</fragment>
+
--- /dev/null
+<?xml version="1.0"?>
+<component name="org.collectionspace.objectexit.ecm.types">
+ <extension target="org.nuxeo.ecm.platform.types.TypeService" point="types">
+ <type id="ObjectExit" coretype="ObjectExit">
+ <label>org.collectionspace.objectexit</label>
+ <!--icon>/icons/file.gif</icon-->
+ <default-view>view_documents</default-view>
+
+ <layouts mode="any">
+ <layout>heading</layout>
+ <layout>collectionspace_core</layout>
+ <layout>objectexit</layout>
+ </layouts>
+ </type>
+
+ <type id="Folder" coretype="Folder">
+ <subtypes>
+ <type>ObjectExit</type>
+ </subtypes>
+ </type>
+
+ <type id="Workspace" coretype="Workspace">
+ <subtypes>
+ <type>ObjectExit</type>
+ </subtypes>
+ </type>
+
+ </extension>
+</component>
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+layouts-contrib.xml
+
+Layout file for configuring screen layouts in the
+user interface of Nuxeo EP's web application, for
+viewing or editing CollectionSpace records stored
+in the Nuxeo repository,
+
+See the "Nuxeo Book" for an introductory description
+of how to edit this file. For instance, for Nuxeo EP 5.3:
+http://doc.nuxeo.org/5.3/books/nuxeo-book/html/
+
+$LastChangedRevision: $
+$LastChangedDate: $
+-->
+
+<component name="org.collectionspace.objectexit.layouts.webapp">
+
+ <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
+ point="layouts">
+
+ <layout name="objectexit">
+ <templates>
+ <template mode="any">/layouts/layout_default_template.xhtml</template>
+ </templates>
+
+ <rows>
+ <row><widget>objectExitNumber</widget></row>
+ <row><widget>borrower</widget></row>
+ <row><widget>borrowersContact</widget></row>
+ <row><widget>lendersAuthorizer</widget></row>
+ <row><widget>lendersAuthorizationDate</widget></row>
+ <row><widget>lendersContact</widget></row>
+
+ <!--
+ Omitting loaned object status fields in release 0.5.2,
+ as these are likely to be repeatable or else handled
+ in some alternate way in release 0.7.
+ -->
+ <!-- <row><widget>loanedObjectStatus</widget></row> -->
+ <!-- <row><widget>loanedObjectStatusDate</widget></row> -->
+ <!-- <row><widget>loanedObjectStatusNote</widget></row> -->
+
+ <row><widget>objectExitDate</widget></row>
+ <row><widget>loanReturnDate</widget></row>
+ <row><widget>loanRenewalApplicationDate</widget></row>
+ <row><widget>specialConditionsOfLoan</widget></row>
+ <row><widget>objectExitNote</widget></row>
+ <row><widget>loanPurpose</widget></row>
+ </rows>
+
+ <widget name="objectExitNumber" type="text">
+ <labels>
+ <label mode="any">objectExitNumber</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="objectexit_common">objectExitNumber</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="borrower" type="text">
+ <labels>
+ <label mode="any">borrower</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="objectexit_common">borrower</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="borrowersContact" type="text">
+ <labels>
+ <label mode="any">borrowersContact</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="objectexit_common">borrowersContact</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="lendersAuthorizer" type="text">
+ <labels>
+ <label mode="any">lendersAuthorizer</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="objectexit_common">lendersAuthorizer</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="lendersAuthorizationDate" type="text">
+ <labels>
+ <label mode="any">lendersAuthorizationDate</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="objectexit_common">lendersAuthorizationDate</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="lendersContact" type="text">
+ <labels>
+ <label mode="any">lendersContact</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="objectexit_common">lendersContact</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="objectExitDate" type="text">
+ <labels>
+ <label mode="any">objectExitDate</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="objectexit_common">objectExitDate</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="loanReturnDate" type="text">
+ <labels>
+ <label mode="any">loanReturnDate</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="objectexit_common">loanReturnDate</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="loanRenewalApplicationDate" type="text">
+ <labels>
+ <label mode="any">loanRenewalApplicationDate</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="objectexit_common">loanRenewalApplicationDate</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="specialConditionsOfLoan" type="text">
+ <labels>
+ <label mode="any">specialConditionsOfLoan</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="objectexit_common">specialConditionsOfLoan</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="objectExitNote" type="text">
+ <labels>
+ <label mode="any">objectExitNote</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="objectexit_common">objectExitNote</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="loanPurpose" type="text">
+ <labels>
+ <label mode="any">loanPurpose</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="objectexit_common">loanPurpose</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ </layout>
+ </extension>
+</component>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+\r
+<!--\r
+ Loan Out schema (XSD)\r
+ \r
+ Entity : ObjectExit\r
+ Part : Common\r
+ Used for: Nuxeo EP core document type\r
+\r
+ $LastChangedRevision: 2316 $\r
+ $LastChangedDate: 2010-06-02 16:03:51 -0700 (Wed, 02 Jun 2010) $\r
+-->\r
+\r
+<xs:schema \r
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"\r
+ xmlns:ns="http://collectionspace.org/objectexit/"\r
+ xmlns="http://collectionspace.org/objectexit/"\r
+ targetNamespace="http://collectionspace.org/objectexit/"\r
+ version="0.1">\r
+ \r
+ <!-- See http://wiki.collectionspace.org/display/collectionspace/Loans+Out+Schema -->\r
+\r
+ <!-- ObjectExit Information Group -->\r
+ <xs:element name="currentOwner" type="xs:string"/>\r
+ <xs:element name="depositor" type="xs:string"/>\r
+ <xs:element name="exitDate" type="xs:string"/>\r
+ <xs:element name="exitMethod" type="xs:string"/>\r
+ <xs:element name="exitNote" type="xs:string"/>\r
+ <xs:element name="exitNumber" type="xs:string"/>\r
+ <xs:element name="exitReason" type="xs:string"/>\r
+ <xs:element name="packingNote" type="xs:string"/> \r
+</xs:schema>\r
--- /dev/null
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>org.collectionspace.services.objectexit</artifactId>
+ <groupId>org.collectionspace.services</groupId>
+ <version>0.9-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.objectexit.3rdparty</artifactId>
+ <name>services.objectexit.3rdparty</name>
+ <packaging>pom</packaging>
+
+ <description>
+ 3rd party build for objectexit service
+ </description>
+
+ <modules>
+ <module>nuxeo-platform-cs-objectexit</module>
+ </modules>
+</project>
--- /dev/null
+
+<project name="objectexit" default="package" basedir=".">
+ <description>
+ objectexit service
+ </description>
+ <!-- set global properties for this build -->
+ <property name="services.trunk" value="../.."/>
+ <!-- environment should be declared before reading build.properties -->
+ <property environment="env" />
+ <property file="${services.trunk}/build.properties" />
+ <property name="mvn.opts" value="" />
+ <property name="src" location="src"/>
+
+ <condition property="osfamily-unix">
+ <os family="unix" />
+ </condition>
+ <condition property="osfamily-windows">
+ <os family="windows" />
+ </condition>
+
+ <target name="package" depends="package-unix,package-windows"
+ description="Package CollectionSpace Services" />
+
+ <target name="package-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="package-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+
+ <target name="install" depends="install-unix,install-windows"
+ description="Install" />
+ <target name="install-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="install-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="clean" depends="clean-unix,clean-windows"
+ description="Delete target directories" >
+ <delete dir="${build}"/>
+ </target>
+ <target name="clean-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="clean-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="test" depends="test-unix,test-windows" description="Run tests" />
+ <target name="test-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="test-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="deploy" depends="install"
+ description="deploy objectexit service">
+ <ant antfile="3rdparty/build.xml" target="deploy" inheritall="false"/>
+ </target>
+
+ <target name="undeploy"
+ description="undeploy objectexit service">
+ <ant antfile="3rdparty/build.xml" target="undeploy" inheritall="false"/>
+ </target>
+
+ <target name="dist" depends="package"
+ description="distribute objectexit service">
+ <ant antfile="3rdparty/build.xml" target="dist" inheritall="false"/>
+ </target>
+
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>org.collectionspace.services.objectexit.client</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.objectexit</artifactId>
+ <version>0.9-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.objectexit.client</artifactId>
+ <name>services.objectexit.client</name>
+
+ <dependencies>
+ <!-- keep slf4j dependencies on the top -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+<!-- CollectionSpace dependencies -->
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.common</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.objectexit.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.person.client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+<!-- External dependencies -->
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <!-- filter out unwanted jars -->
+ <exclusions>
+ <exclusion>
+ <groupId>tjws</groupId>
+ <artifactId>webserver</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-multipart-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>collectionspace-services-objectexit-client</finalName>
+ </build>
+</project>
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright (c) 2009 Regents of the University of California
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ */
+package org.collectionspace.services.client;
+
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+//import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.objectexit.ObjectexitCommonList;
+
+import org.jboss.resteasy.client.ProxyFactory;
+import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+
+/**
+ * ObjectExitClient.java
+ *
+ * $LastChangedRevision: 2108 $
+ * $LastChangedDate: 2010-05-17 18:25:37 -0700 (Mon, 17 May 2010) $
+ *
+ */
+public class ObjectExitClient extends AbstractServiceClientImpl {
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.AbstractServiceClientImpl#getServicePathComponent()
+ */
+ public String getServicePathComponent() {
+ return "objectexit"; //Laramie20100824 was objectexits, but label was a mismatch.
+ }
+ /**
+ *
+ */
+// private static final ObjectExitClient instance = new ObjectExitClient();
+ /**
+ *
+ */
+ private ObjectExitProxy objectexitProxy;
+
+ /**
+ *
+ * Default constructor for ObjectExitClient class.
+ *
+ */
+ public ObjectExitClient() {
+ ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
+ RegisterBuiltin.register(factory);
+ setProxy();
+ }
+
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.objectexitProxy;
+ }
+
+ /**
+ * allow to reset proxy as per security needs
+ */
+ public void setProxy() {
+ if (useAuth()) {
+ objectexitProxy = ProxyFactory.create(ObjectExitProxy.class,
+ getBaseURL(), getHttpClient());
+ } else {
+ objectexitProxy = ProxyFactory.create(ObjectExitProxy.class,
+ getBaseURL());
+ }
+ }
+
+ /**
+ * FIXME Comment this
+ *
+ * @return
+ */
+// public static ObjectExitClient getInstance() {
+// return instance;
+// }
+
+ /**
+ * @return
+ * @see org.collectionspace.services.client.ObjectExitProxy#getObjectExit()
+ */
+ public ClientResponse<ObjectexitCommonList> readList() {
+ return objectexitProxy.readList();
+ }
+
+ /**
+ * @param csid
+ * @return
+ * @see org.collectionspace.services.client.ObjectExitProxy#getAuthorityRefs(java.lang.String)
+ */
+ public ClientResponse<AuthorityRefList> getAuthorityRefs(String csid) {
+ return objectexitProxy.getAuthorityRefs(csid);
+ }
+
+
+ /**
+ * @param csid
+ * @return
+ * @see org.collectionspace.services.client.ObjectExitProxy#getObjectExit(java.lang.String)
+ */
+ public ClientResponse<MultipartInput> read(String csid) {
+ return objectexitProxy.read(csid);
+ }
+
+ /**
+ * @param objectexit
+ * @return
+ *
+ */
+ public ClientResponse<Response> create(MultipartOutput multipart) {
+ return objectexitProxy.create(multipart);
+ }
+
+ /**
+ * @param csid
+ * @param objectexit
+ * @return
+ */
+ public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
+ return objectexitProxy.update(csid, multipart);
+
+ }
+
+ /**
+ * @param csid
+ * @return
+ * @see org.collectionspace.services.client.ObjectExitProxy#deleteObjectExit(java.lang.Long)
+ */
+ public ClientResponse<Response> delete(String csid) {
+ return objectexitProxy.delete(csid);
+ }
+}
--- /dev/null
+package org.collectionspace.services.client;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.objectexit.ObjectexitCommonList;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+
+/**
+ * @version $Revision: 2108 $
+ */
+@Path("/objectexit/")
+@Produces({"multipart/mixed"})
+@Consumes({"multipart/mixed"})
+public interface ObjectExitProxy extends CollectionSpaceProxy {
+
+ //(C)reate
+ @POST
+ ClientResponse<Response> create(MultipartOutput multipart);
+
+ //(R)ead
+ @GET
+ @Path("/{csid}")
+ ClientResponse<MultipartInput> read(@PathParam("csid") String csid);
+
+ //(U)pdate
+ @PUT
+ @Path("/{csid}")
+ ClientResponse<MultipartInput> update(@PathParam("csid") String csid, MultipartOutput multipart);
+
+ //(D)elete
+ @DELETE
+ @Path("/{csid}")
+ ClientResponse<Response> delete(@PathParam("csid") String csid);
+
+ // List
+ @GET
+ @Produces({"application/xml"})
+ ClientResponse<ObjectexitCommonList> readList();
+
+ // List Authority References
+ @GET
+ @Produces({"application/xml"})
+ @Path("/{csid}/authorityrefs/")
+ ClientResponse<AuthorityRefList> getAuthorityRefs(@PathParam("csid") String csid);
+
+}
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright © 2009 Regents of the University of California
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ *
+ * 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.
+ */
+package org.collectionspace.services.client.test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.PersonJAXBSchema;
+import org.collectionspace.services.client.CollectionSpaceClient;
+import org.collectionspace.services.client.ObjectExitClient;
+import org.collectionspace.services.client.PersonAuthorityClient;
+import org.collectionspace.services.client.PersonAuthorityClientUtils;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.objectexit.ObjectexitCommon;
+
+import org.jboss.resteasy.client.ClientResponse;
+
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ObjectExitAuthRefsTest, carries out Authority References tests against a deployed and running ObjectExit (aka Loans Out) Service.
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ */
+public class ObjectExitAuthRefsTest extends BaseServiceTest {
+
+ private final String CLASS_NAME = ObjectExitAuthRefsTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+ final String SERVICE_PATH_COMPONENT = "objectexit";
+ final String PERSON_AUTHORITY_NAME = "ObjectexitPersonAuth";
+ private String knownResourceId = null;
+ private List<String> objectexitIdsCreated = new ArrayList<String>();
+ private List<String> personIdsCreated = new ArrayList<String>();
+ private String personAuthCSID = null;
+ private String depositorRefName = null;
+ private String exitDate = null;
+ private String exitNumber = null;
+
+ @Override
+ protected CollectionSpaceClient getClientInstance() {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
+ @Override
+ protected AbstractCommonList getAbstractCommonList(ClientResponse<AbstractCommonList> response) {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
+ @Override
+ public String getServicePathComponent() {
+ return SERVICE_PATH_COMPONENT;
+ }
+
+ private MultipartOutput createObjectExitInstance(String depositorRefName, String exitNumber, String exitDate) {
+ this.exitDate = exitDate;
+ this.exitNumber = exitNumber;
+ this.depositorRefName = depositorRefName;
+ ObjectexitCommon objectexit = new ObjectexitCommon();
+ objectexit.setDepositor(depositorRefName);
+ objectexit.setExitNumber(exitNumber);
+ objectexit.setExitDate(exitDate);
+
+ MultipartOutput multipart = new MultipartOutput();
+ OutputPart commonPart = multipart.addPart(objectexit, MediaType.APPLICATION_XML_TYPE);
+ commonPart.getHeaders().add("label", new ObjectExitClient().getCommonPartName());
+ logger.debug("to be created, objectexit common: " + objectAsXmlString(objectexit, ObjectexitCommon.class));
+ return multipart;
+ }
+
+ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+ public void createWithAuthRefs(String testName) throws Exception {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
+ String identifier = createIdentifier(); // Submit the request to the service and store the response.
+ createPersonRefs();// Create all the person refs and entities
+ // Create a new Loans In resource. One or more fields in this resource will be PersonAuthority
+ // references, and will refer to Person resources by their refNames.
+ ObjectExitClient objectexitClient = new ObjectExitClient();
+ MultipartOutput multipart = createObjectExitInstance(depositorRefName, "exitNumber-" + identifier, "exitDate-" + identifier);
+ ClientResponse<Response> res = objectexitClient.create(multipart);
+ assertStatusCode(res, testName);
+ if (knownResourceId == null) {// Store the ID returned from the first resource created for additional tests below.
+ knownResourceId = extractId(res);
+ }
+ objectexitIdsCreated.add(extractId(res));// Store the IDs from every resource created; delete on cleanup
+ }
+
+ protected void createPersonRefs() {
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ // Create a temporary PersonAuthority resource, and its corresponding refName by which it can be identified.
+ MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName());
+ ClientResponse<Response> res = personAuthClient.create(multipart);
+ assertStatusCode(res, "createPersonRefs (not a surefire test)");
+ personAuthCSID = extractId(res);
+ String authRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
+ // Create temporary Person resources, and their corresponding refNames by which they can be identified.
+ String csid = "";
+
+ csid = createPerson("Owen the Cur", "Owner", "owenCurOwner", authRefName);
+ personIdsCreated.add(csid);
+ depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+
+ csid = createPerson("Davenport", "Depositor", "davenportDepositor", authRefName);
+ personIdsCreated.add(csid);
+ depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+ }
+
+ protected String createPerson(String firstName, String surName, String shortId, String authRefName) {
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ Map<String, String> personInfo = new HashMap<String, String>();
+ personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
+ personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
+ personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
+ MultipartOutput multipart = PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, authRefName, personInfo, personAuthClient.getItemCommonPartName());
+ ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
+ assertStatusCode(res, "createPerson (not a surefire test)");
+ return extractId(res);
+ }
+
+ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createWithAuthRefs"})
+ public void readAndCheckAuthRefs(String testName) throws Exception {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ testSetup(STATUS_OK, ServiceRequestType.READ);
+ ObjectExitClient objectexitClient = new ObjectExitClient();
+ ClientResponse<MultipartInput> res = objectexitClient.read(knownResourceId);
+ assertStatusCode(res, testName);
+ MultipartInput input = (MultipartInput) res.getEntity();
+ ObjectexitCommon objectexit = (ObjectexitCommon) extractPart(input, objectexitClient.getCommonPartName(), ObjectexitCommon.class);
+ Assert.assertNotNull(objectexit);
+ logger.debug(objectAsXmlString(objectexit, ObjectexitCommon.class));
+
+ // Check a couple of fields
+ Assert.assertEquals(objectexit.getDepositor(), depositorRefName);
+ Assert.assertEquals(objectexit.getExitDate(), exitDate);
+ Assert.assertEquals(objectexit.getExitNumber(), exitNumber);
+
+ // Get the auth refs and check them
+ ClientResponse<AuthorityRefList> res2 = objectexitClient.getAuthorityRefs(knownResourceId);
+ assertStatusCode(res2, testName);
+ AuthorityRefList list = res2.getEntity();
+ List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
+ int numAuthRefsFound = items.size();
+ logger.debug("Authority references, found " + numAuthRefsFound);
+ //Assert.assertEquals(numAuthRefsFound, NUM_AUTH_REFS_EXPECTED,
+ // "Did not find all expected authority references! " +
+ // "Expected " + NUM_AUTH_REFS_EXPECTED + ", found " + numAuthRefsFound);
+ if (logger.isDebugEnabled()) {
+ int i = 0;
+ for (AuthorityRefList.AuthorityRefItem item : items) {
+ logger.debug(testName + ": list-item[" + i + "] Field:" + item.getSourceField() + "= " + item.getAuthDisplayName() + item.getItemDisplayName());
+ logger.debug(testName + ": list-item[" + i + "] refName=" + item.getRefName());
+ logger.debug(testName + ": list-item[" + i + "] URI=" + item.getUri());
+ i++;
+ }
+ }
+ }
+
+ /**
+ * Deletes all resources created by tests, after all tests have been run.
+ * <p/>
+ * This cleanup method will always be run, even if one or more tests fail.
+ * For this reason, it attempts to remove all resources created
+ * at any point during testing, even if some of those resources
+ * may be expected to be deleted by certain tests.
+ */
+ @AfterClass(alwaysRun = true)
+ public void cleanUp() {
+ String noTest = System.getProperty("noTestCleanup");
+ if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
+ logger.debug("Skipping Cleanup phase ...");
+ return;
+ }
+ logger.debug("Cleaning up temporary resources created for testing ...");
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ // Delete Person resource(s) (before PersonAuthority resources).
+ for (String resourceId : personIdsCreated) {
+ // Note: Any non-success responses are ignored and not reported.
+ personAuthClient.deleteItem(personAuthCSID, resourceId);
+ }
+ // Delete PersonAuthority resource(s).
+ // Note: Any non-success response is ignored and not reported.
+ if (personAuthCSID != null) {
+ personAuthClient.delete(personAuthCSID);
+ // Delete Loans In resource(s).
+ ObjectExitClient objectexitClient = new ObjectExitClient();
+ for (String resourceId : objectexitIdsCreated) {
+ // Note: Any non-success responses are ignored and not reported.
+ objectexitClient.delete(resourceId);
+ }
+ }
+ }
+
+}
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright © 2009 Regents of the University of California
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ *
+ * 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.
+ */
+package org.collectionspace.services.client.test;
+
+import java.util.List;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.client.CollectionSpaceClient;
+import org.collectionspace.services.client.ObjectExitClient;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.objectexit.ObjectexitCommon;
+import org.collectionspace.services.objectexit.ObjectexitCommonList;
+
+import org.jboss.resteasy.client.ClientResponse;
+
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ObjectExitServiceTest, carries out tests against a deployed and running ObjectExit Service. <p/>
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ */
+public class ObjectExitServiceTest extends AbstractServiceTestImpl {
+
+ private final String CLASS_NAME = ObjectExitServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+ final String SERVICE_PATH_COMPONENT = "objectexit";
+ private String knownResourceId = null;
+
+ @Override
+ protected CollectionSpaceClient getClientInstance() {
+ return new ObjectExitClient();
+ }
+
+ @Override
+ protected AbstractCommonList getAbstractCommonList(ClientResponse<AbstractCommonList> response) {
+ return response.getEntity(ObjectexitCommonList.class);
+ }
+
+ @Override
+ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+ public void create(String testName) throws Exception {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ setupCreate();
+ ObjectExitClient client = new ObjectExitClient();
+ MultipartOutput multipart = createObjectExitInstance(createIdentifier());
+ ClientResponse<Response> res = client.create(multipart);
+ assertStatusCode(res, testName);
+ if (knownResourceId == null) {
+ knownResourceId = extractId(res); // Store the ID returned from the first resource created for additional tests below.
+ logger.debug(testName + ": knownResourceId=" + knownResourceId);
+ }
+ allResourceIdsCreated.add(extractId(res)); // Store the IDs from every resource created by tests so they can be deleted after tests have been run.
+ }
+
+ @Override
+ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
+ public void createList(String testName) throws Exception {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ for (int i = 0; i < 3; i++) {
+ create(testName);
+ }
+ }
+
+ @Override
+ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
+ public void read(String testName) throws Exception {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ setupRead();
+ ObjectExitClient client = new ObjectExitClient();
+ ClientResponse<MultipartInput> res = client.read(knownResourceId);
+ assertStatusCode(res, testName);
+ MultipartInput input = (MultipartInput) res.getEntity();
+ ObjectexitCommon objectexit = (ObjectexitCommon) extractPart(input, client.getCommonPartName(), ObjectexitCommon.class);
+ Assert.assertNotNull(objectexit);
+ }
+
+ @Override
+ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createList", "read"})
+ public void readList(String testName) throws Exception {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ setupReadList();
+ ObjectExitClient client = new ObjectExitClient();
+ ClientResponse<ObjectexitCommonList> res = client.readList();
+ ObjectexitCommonList list = res.getEntity();
+ assertStatusCode(res, testName);
+ if (logger.isDebugEnabled()) {
+ List<ObjectexitCommonList.ObjectexitListItem> items = list.getObjectexitListItem();
+ int i = 0;
+ for (ObjectexitCommonList.ObjectexitListItem item : items) {
+ logger.debug(testName + ": list-item[" + i + "] csid=" + item.getCsid());
+ logger.debug(testName + ": list-item[" + i + "] objectExitNumber=" + item.getExitNumber());
+ logger.debug(testName + ": list-item[" + i + "] URI=" + item.getUri());
+ i++;
+ }
+ }
+ }
+
+ @Override
+ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
+ public void update(String testName) throws Exception {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ setupUpdate();
+ ObjectExitClient client = new ObjectExitClient();
+ ClientResponse<MultipartInput> res = client.read(knownResourceId);
+ assertStatusCode(res, testName);
+ logger.debug("got object to update with ID: " + knownResourceId);
+ MultipartInput input = (MultipartInput) res.getEntity();
+ ObjectexitCommon objectexit = (ObjectexitCommon) extractPart(input, client.getCommonPartName(), ObjectexitCommon.class);
+ Assert.assertNotNull(objectexit);
+
+ objectexit.setExitNumber("updated-" + objectexit.getExitNumber());
+ logger.debug("Object to be updated:"+objectAsXmlString(objectexit, ObjectexitCommon.class));
+ MultipartOutput output = new MultipartOutput();
+ OutputPart commonPart = output.addPart(objectexit, MediaType.APPLICATION_XML_TYPE);
+ commonPart.getHeaders().add("label", client.getCommonPartName());
+ res = client.update(knownResourceId, output);
+ assertStatusCode(res, testName);
+ input = (MultipartInput) res.getEntity();
+ ObjectexitCommon updatedObjectExit = (ObjectexitCommon) extractPart(input, client.getCommonPartName(), ObjectexitCommon.class);
+ Assert.assertNotNull(updatedObjectExit);
+ }
+
+ @Override
+ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"update", "testSubmitRequest"})
+ public void updateNonExistent(String testName) throws Exception {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ setupUpdateNonExistent();
+ // Submit the request to the service and store the response.
+ // Note: The ID used in this 'create' call may be arbitrary.
+ // The only relevant ID may be the one used in update(), below.
+ ObjectExitClient client = new ObjectExitClient();
+ MultipartOutput multipart = createObjectExitInstance(NON_EXISTENT_ID);
+ ClientResponse<MultipartInput> res = client.update(NON_EXISTENT_ID, multipart);
+ assertStatusCode(res, testName);
+ }
+
+ @Override
+ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
+ public void delete(String testName) throws Exception {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ setupDelete();
+ ObjectExitClient client = new ObjectExitClient();
+ ClientResponse<Response> res = client.delete(knownResourceId);
+ assertStatusCode(res, testName);
+ }
+
+ // ---------------------------------------------------------------
+ // Failure outcome tests : means we expect response to fail, but test to succeed
+ // ---------------------------------------------------------------
+
+ // Failure outcome
+ @Override
+ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
+ public void readNonExistent(String testName) throws Exception {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ setupReadNonExistent();
+ ObjectExitClient client = new ObjectExitClient();
+ ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
+ assertStatusCode(res, testName);
+ }
+
+ // Failure outcome
+ @Override
+ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"delete"})
+ public void deleteNonExistent(String testName) throws Exception {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ setupDeleteNonExistent();
+ ObjectExitClient client = new ObjectExitClient();
+ ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
+ assertStatusCode(res, testName);
+ }
+
+ // Failure outcomes
+ // Placeholders until the tests below can be implemented. See Issue CSPACE-401.
+
+ @Override
+ public void createWithEmptyEntityBody(String testName) throws Exception {
+ }
+
+ @Override
+ public void createWithMalformedXml(String testName) throws Exception {
+ }
+
+ @Override
+ public void createWithWrongXmlSchema(String testName) throws Exception {
+ }
+
+ @Override
+ public void updateWithEmptyEntityBody(String testName) throws Exception {
+ }
+
+ @Override
+ public void updateWithMalformedXml(String testName) throws Exception {
+ }
+
+ @Override
+ public void updateWithWrongXmlSchema(String testName) throws Exception {
+ }
+
+ // ---------------------------------------------------------------
+ // Utility tests : tests of code used in tests above
+ // ---------------------------------------------------------------
+
+ @Test(dependsOnMethods = {"create", "read"})
+ public void testSubmitRequest() {
+ final int EXPECTED_STATUS = Response.Status.OK.getStatusCode(); // Expected status code: 200 OK
+ String method = ServiceRequestType.READ.httpMethodName();
+ String url = getResourceURL(knownResourceId);
+ int statusCode = submitRequest(method, url);
+ logger.debug("testSubmitRequest: url=" + url + " status=" + statusCode);
+ Assert.assertEquals(statusCode, EXPECTED_STATUS);
+ }
+
+ // ---------------------------------------------------------------
+ // Utility methods used by tests above
+ // ---------------------------------------------------------------
+
+ @Override
+ public String getServicePathComponent() {
+ return SERVICE_PATH_COMPONENT;
+ }
+
+ private MultipartOutput createObjectExitInstance(String exitNumber) {
+ String identifier = "objectexitNumber-" + exitNumber;
+ ObjectexitCommon objectexit = new ObjectexitCommon();
+ objectexit.setExitNumber(identifier);
+ objectexit.setDepositor("urn:cspace:org.collectionspace.demo:orgauthority:name(TestOrgAuth):organization:name(Northern Climes Museum)'Northern Climes Museum'");
+ MultipartOutput multipart = new MultipartOutput();
+ OutputPart commonPart = multipart.addPart(objectexit, MediaType.APPLICATION_XML_TYPE);
+ commonPart.getHeaders().add("label", new ObjectExitClient().getCommonPartName());
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("to be created, objectexit common");
+ logger.debug(objectAsXmlString(objectexit, ObjectexitCommon.class));
+ }
+
+ return multipart;
+ }
+}
--- /dev/null
+log4j.rootLogger=debug, stdout, R\r
+\r
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender\r
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout\r
+\r
+# Pattern to output the caller's file name and line number.\r
+log4j.appender.stdout.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n\r
+\r
+log4j.appender.R=org.apache.log4j.RollingFileAppender\r
+log4j.appender.R.File=target/test-client.log\r
+\r
+log4j.appender.R.MaxFileSize=100KB\r
+# Keep one backup file\r
+log4j.appender.R.MaxBackupIndex=1\r
+\r
+log4j.appender.R.layout=org.apache.log4j.PatternLayout\r
+log4j.appender.R.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n\r
+\r
+#packages\r
+log4j.logger.org.collectionspace=DEBUG\r
+log4j.logger.org.apache=INFO\r
+log4j.logger.httpclient=INFO\r
+log4j.logger.org.jboss.resteasy=INFO\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+ <classpathentry kind="src" output="target/classes" path="target/generated-sources/xjc"/>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>org.collectionspace.services.objectexit.jaxb</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>org.collectionspace.services.objectexit</artifactId>
+ <groupId>org.collectionspace.services</groupId>
+ <version>0.9-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.objectexit.jaxb</artifactId>
+ <name>services.objectexit.jaxb</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.jaxb2-commons</groupId>
+ <artifactId>property-listener-injector</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.jaxb2_commons</groupId>
+ <artifactId>runtime</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>collectionspace-services-objectexit-jaxb</finalName>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+
--- /dev/null
+/**
+ *
+ */
+package org.collectionspace.services;
+
+public interface ObjectexitJAXBSchema {
+ final static String OBJECT_EXIT_CURRENT_OWNER = "currentOwner";
+ final static String OBJECT_EXIT_DEPOSITOR = "depositor";
+ final static String OBJECT_EXIT_DATE = "exitDate";
+ final static String OBJECT_EXIT_METHOD = "exitMethod";
+ final static String OBJECT_EXIT_NOTE = "exitNote";
+ final static String OBJECT_EXIT_NUMBER = "exitNumber";
+ final static String OBJECT_EXIT_REASON = "exitReason";
+ final static String OBJECT_EXIT_PACKING_NOTE = "packingNote";
+}
--- /dev/null
+package org.collectionspace.services;
+
+public interface ObjectexitListItemJAXBSchema {
+ final static String OBJECT_EXIT_CURRENT_OWNER = "currentOwner";
+ final static String OBJECT_EXIT_DEPOSITOR = "depositor";
+ final static String OBJECT_EXIT_DATE = "exitDate";
+ final static String OBJECT_EXIT_METHOD = "exitMethod";
+ final static String OBJECT_EXIT_NOTE = "exitNote";
+ final static String OBJECT_EXIT_NUMBER = "exitNumber";
+ final static String OBJECT_EXIT_REASON = "exitReason";
+ final static String OBJECT_EXIT_PACKING_NOTE = "packingNote";
+
+ final static String CSID = "csid";
+ final static String URI = "url";
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+ Loan Out schema (XSD)
+
+ Entity : ObjectExit
+ Part : Common
+ Used for: JAXB binding between XML and Java objects
+
+ $LastChangedRevision: 2316 $
+ $LastChangedDate: 2010-06-02 16:03:51 -0700 (Wed, 02 Jun 2010) $
+-->
+
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ jaxb:version="1.0" elementFormDefault="unqualified"
+ xmlns:ns="http://collectionspace.org/services/objectexit"
+ xmlns="http://collectionspace.org/services/objectexit"
+ targetNamespace="http://collectionspace.org/services/objectexit"
+ version="0.1"
+>
+
+<!--
+ Avoid XmlRootElement nightmare:
+ See http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
+-->
+<!-- See http://wiki.collectionspace.org/display/collectionspace/Loans+Out+Schema -->
+
+ <!-- objectexit -->
+ <xs:element name="objectexit_common">
+ <xs:complexType>
+ <xs:sequence>
+ <!-- ObjectExit Information Group -->
+ <xs:element name="currentOwner" type="xs:string"/>
+ <xs:element name="depositor" type="xs:string"/>
+ <xs:element name="exitDate" type="xs:string"/>
+ <xs:element name="exitMethod" type="xs:string"/>
+ <xs:element name="exitNote" type="xs:string"/>
+ <xs:element name="exitNumber" type="xs:string"/>
+ <xs:element name="exitReason" type="xs:string"/>
+ <xs:element name="packingNote" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- This is the base class for paginated lists -->
+ <xs:complexType name="abstractCommonList">
+ <xs:annotation>
+ <xs:appinfo>
+ <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:complexType>
+
+ <!-- objectexit records, as in nuxeo repository -->
+ <xs:element name="objectexit_common_list">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="abstractCommonList">
+ <xs:sequence>
+ <xs:element name="objectexit_list_item" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="currentOwner" type="xs:string" minOccurs="1" />
+ <xs:element name="depositor" type="xs:string" minOccurs="1" />
+ <xs:element name="exitDate" type="xs:string" minOccurs="1" />
+ <xs:element name="exitMethod" type="xs:string" minOccurs="1" />
+ <xs:element name="exitNote" type="xs:string" minOccurs="1" />
+ <xs:element name="exitNumber" type="xs:string" minOccurs="1" />
+ <xs:element name="exitReason" type="xs:string" minOccurs="1" />
+ <xs:element name="packingNote" type="xs:string" minOccurs="1" />
+ <xs:element name="uri" type="xs:anyURI" minOccurs="1" />
+ <xs:element name="csid" type="xs:string" minOccurs="1" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- A comment. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.main</artifactId>
+ <version>0.9-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.objectexit</artifactId>
+ <name>services.objectexit</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>jaxb</module>
+ <module>service</module>
+ <module>3rdparty</module>
+ <module>client</module>
+ </modules>
+
+</project>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>org.collectionspace.services.objectexit.service</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.objectexit</artifactId>
+ <version>0.9-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.objectexit.service</artifactId>
+ <name>services.objectexit.service</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.objectexit.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.collectionobject.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!-- External dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.6</version>
+ </dependency>
+
+ <!-- javax -->
+
+ <dependency>
+ <groupId>javax.security</groupId>
+ <artifactId>jaas</artifactId>
+ <version>1.0.01</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- jboss -->
+
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>tjws</groupId>
+ <artifactId>webserver</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-multipart-provider</artifactId>
+ </dependency>
+
+ <!-- nuxeo -->
+
+ <dependency>
+ <groupId>org.nuxeo.ecm.core</groupId>
+ <artifactId>nuxeo-core-api</artifactId>
+ <version>1.5.1-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>jboss-remoting</artifactId>
+ <groupId>jboss</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.restlet</groupId>
+ <artifactId>org.restlet</artifactId>
+ <version>1.0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>com.noelios.restlet</groupId>
+ <artifactId>com.noelios.restlet.ext.httpclient</artifactId>
+ <version>1.0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>com.noelios.restlet</groupId>
+ <artifactId>com.noelios.restlet</artifactId>
+ <version>1.0.7</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>collectionspace-services-objectexit</finalName>
+ </build>
+</project>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<profilesXml xmlns="http://maven.apache.org/PROFILES/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/PROFILES/1.0.0 http://maven.apache.org/xsd/profiles-1.0.0.xsd">
+</profilesXml>
\ No newline at end of file
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+
+ * Copyright 2009 University of California at Berkeley
+
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+
+ * You may obtain a copy of the ECL 2.0 License at
+
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+
+ * 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.
+ */
+package org.collectionspace.services.objectexit;
+
+import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.ClientType;
+import org.collectionspace.services.common.ServiceMain;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MultivaluedMap;
+import java.util.List;
+
+@Path("/objectexit")
+@Consumes("multipart/mixed")
+@Produces("multipart/mixed")
+public class ObjectExitResource extends ResourceBase {
+
+ @Override
+ public String getServiceName(){
+ return "objectexit";
+ };
+
+ //FIXME retrieve client type from configuration
+ final static ClientType CLIENT_TYPE = ServiceMain.getInstance().getClientType();
+
+ @Override
+ protected String getVersionString() {
+ final String lastChangeRevision = "$LastChangedRevision: 2108 $";
+ return lastChangeRevision;
+ }
+
+ @Override
+ public Class<ObjectexitCommon> getCommonPartClass() {
+ return ObjectexitCommon.class;
+ }
+
+ public Class getResourceClass() {
+ return this.getClass();
+ }
+
+ public ObjectexitCommonList getObjectexitList(MultivaluedMap<String, String> queryParams) {
+ return (ObjectexitCommonList)getList(queryParams);
+ }
+
+ @Deprecated
+ public ObjectexitCommonList getObjectexitList(List<String> csidList) {
+ return (ObjectexitCommonList) getList(csidList);
+ }
+
+ protected ObjectexitCommonList search(MultivaluedMap<String,String> queryParams,String keywords) {
+ return (ObjectexitCommonList) super.search(queryParams, keywords);
+ }
+
+
+}
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+
+ * Copyright 2009 University of California at Berkeley
+
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+
+ * You may obtain a copy of the ECL 2.0 License at
+
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+
+ * 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.
+ */
+package org.collectionspace.services.objectexit.nuxeo;
+
+/**
+ * ObjectExitConstants specifies constants for the Loans Out service
+ *
+ */
+public class ObjectExitConstants {
+
+ public final static String NUXEO_DOCTYPE = "ObjectExit";
+ public final static String NUXEO_SCHEMA_NAME = "objectexit";
+ public final static String NUXEO_DC_TITLE = "CollectionSpace-ObjectExit";
+}
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+
+ * Copyright 2009 University of California at Berkeley
+
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+
+ * You may obtain a copy of the ECL 2.0 License at
+
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+
+ * 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.
+ */
+package org.collectionspace.services.objectexit.nuxeo;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.collectionspace.services.ObjectexitJAXBSchema;
+import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.objectexit.ObjectexitCommon;
+import org.collectionspace.services.objectexit.ObjectexitCommonList;
+import org.collectionspace.services.objectexit.ObjectexitCommonList.ObjectexitListItem;
+import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
+import org.collectionspace.services.nuxeo.util.NuxeoUtils;
+import org.nuxeo.ecm.core.api.DocumentModel;
+import org.nuxeo.ecm.core.api.DocumentModelList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The Class ObjectExitDocumentModelHandler.
+ */
+public class ObjectExitDocumentModelHandler
+ extends RemoteDocumentModelHandlerImpl<ObjectexitCommon, ObjectexitCommonList> {
+
+ /** The logger. */
+ private final Logger logger = LoggerFactory.getLogger(ObjectExitDocumentModelHandler.class);
+
+ /** The objectexit. */
+ private ObjectexitCommon objectexit;
+
+ /** The objectexit list. */
+ private ObjectexitCommonList objectexitList;
+
+
+ /**
+ * Gets the common part.
+ *
+ * @return the common part
+ */
+ @Override
+ public ObjectexitCommon getCommonPart() {
+ return objectexit;
+ }
+
+ /**
+ * Sets the common part.
+ *
+ * @param objectexit the new common part
+ */
+ @Override
+ public void setCommonPart(ObjectexitCommon objectexit) {
+ this.objectexit = objectexit;
+ }
+
+ /**
+ * Gets the common part list.
+ *
+ * @return the common part list
+ */
+ @Override
+ public ObjectexitCommonList getCommonPartList() {
+ return objectexitList;
+ }
+
+ /**
+ * Sets the common part list.
+ *
+ * @param objectexitList the new common part list
+ */
+ @Override
+ public void setCommonPartList(ObjectexitCommonList objectexitList) {
+ this.objectexitList = objectexitList;
+ }
+
+ /**
+ * Extract common part.
+ *
+ * @param wrapDoc the wrap doc
+ * @return the objectexit common
+ * @throws Exception the exception
+ */
+ @Override
+ public ObjectexitCommon extractCommonPart(DocumentWrapper<DocumentModel> wrapDoc)
+ throws Exception {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Fill common part.
+ *
+ * @param objectexitObject the objectexit object
+ * @param wrapDoc the wrap doc
+ * @throws Exception the exception
+ */
+ @Override
+ public void fillCommonPart(ObjectexitCommon objectexitObject, DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Extract common part list.
+ *
+ * @param wrapDoc the wrap doc
+ * @return the objectexit common list
+ * @throws Exception the exception
+ */
+ @Override
+ public ObjectexitCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
+ ObjectexitCommonList coList = extractPagingInfo(new ObjectexitCommonList(), wrapDoc);
+ List<ObjectexitCommonList.ObjectexitListItem> list = coList.getObjectexitListItem();
+ Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
+ while(iter.hasNext()){
+ DocumentModel docModel = iter.next();
+ ObjectexitListItem ilistItem = new ObjectexitListItem();
+
+ String label = getServiceContext().getCommonPartLabel();
+ ilistItem.setExitNumber((String) docModel.getProperty(label, ObjectexitJAXBSchema.OBJECT_EXIT_NUMBER));
+ ilistItem.setExitDate((String) docModel.getProperty(label, ObjectexitJAXBSchema.OBJECT_EXIT_DATE));
+ String id = NuxeoUtils.extractId(docModel.getPathAsString());
+ ilistItem.setUri(getServiceContextPath() + id);
+ ilistItem.setCsid(id);
+ list.add(ilistItem);
+ }
+
+ return coList;
+ }
+
+ /**
+ * Gets the q property.
+ *
+ * @param prop the prop
+ * @return the q property
+ */
+ @Override
+ public String getQProperty(String prop) {
+ return ObjectExitConstants.NUXEO_SCHEMA_NAME + ":" + prop;
+ }
+
+}
+
--- /dev/null
+package org.collectionspace.services.objectexit.nuxeo;
+
+import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.document.InvalidDocumentException;
+import org.collectionspace.services.common.document.ValidatorHandler;
+import org.collectionspace.services.common.document.DocumentHandler.Action;
+
+public class ObjectExitValidatorHandler implements ValidatorHandler {
+
+ @Override
+ public void validate(Action action, ServiceContext ctx)
+ throws InvalidDocumentException {
+ // TODO Auto-generated method stub
+ System.out.println("ObjectExitValidatorHandler executed.");
+
+ }
+
+}
--- /dev/null
+package org.collectionspace.services.test;
+
+//import org.collectionspace.services.objectexit.ObjectExit;
+//import org.collectionspace.services.objectexit.ObjectexitList;
+
+/**
+ * Placeholder for server-side testing of Loan Out service code.
+ *
+ * @version $Revision: 2108 $
+ */
+public class ObjectExitServiceTest {
+ //empty
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <layout class="org.apache.log4j.TTCCLayout">
+ <param name="DateFormat" value="ISO8601" />
+ </layout>
+ </appender>
+
+
+ <appender name="unit-tests"
+ class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="./target/unit-tests.log" />
+ <param name="MaxFileSize" value="10240KB" />
+ <param name="MaxBackupIndex" value="6" />
+ <layout class="org.apache.log4j.TTCCLayout">
+ <param name="DateFormat" value="ISO8601" />
+ </layout>
+ </appender>
+
+ <logger name="org.apache.commons.httpclient" additivity="false">
+ <level value="warn" />
+ <appender-ref ref="console" />
+ <appender-ref ref="unit-tests" />
+ </logger>
+
+ <logger name="httpclient.wire" additivity="false">
+ <level value="info" />
+ <appender-ref ref="console" />
+ <appender-ref ref="unit-tests" />
+ </logger>
+
+ <root>
+ <priority value="debug" />
+ <appender-ref ref="console" />
+ <appender-ref ref="unit-tests" />
+ </root>
+
+</log4j:configuration>
+
+
+
+