Advertisement
Guest User

Untitled

a guest
Jun 7th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.31 KB | None | 0 0
  1. <%-- Set the content type header with the JSP directive --%>
  2. <%@ page contentType="text/xml; charset=UTF-8" %>
  3.  
  4. <%-- Set the content disposition header --%>
  5.  
  6. <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
  7. <%@ page import="com.tridion.dynamiccontent.*" %>
  8. <%@page import="com.tridion.broker.StorageException,
  9. com.tridion.broker.querying.*,
  10. com.tridion.broker.querying.Query,
  11. com.tridion.broker.querying.criteria.*,
  12. com.tridion.broker.querying.criteria.categorization.*,
  13. com.tridion.broker.querying.criteria.content.*,
  14. com.tridion.broker.querying.criteria.metadata.*,
  15. com.tridion.broker.querying.criteria.operators.*,
  16. com.tridion.broker.querying.criteria.taxonomy.*,
  17. com.tridion.broker.querying.filter.LimitFilter,
  18. com.tridion.broker.querying.sorting.SortParameter,
  19. com.tridion.broker.querying.criteria.metadata.CustomMetaKeyCriteria,
  20. com.tridion.broker.querying.criteria.metadata.CustomMetaValueCriteria,
  21. com.tridion.broker.querying.criteria.operators.AndCriteria,
  22. com.tridion.broker.querying.criteria.operators.OrCriteria,
  23. com.tridion.broker.querying.criteria.operators.NotInCriteria,
  24. java.util.ArrayList,
  25. org.apache.commons.lang.*"%>
  26.  
  27.  
  28. <%
  29.  
  30. String templateUri = "tcm:123-456-78";
  31. int publicationId = 123;
  32. int templateId = 456;
  33.  
  34. String key = "";
  35. String values[] = null;
  36. StringBuffer sb = new StringBuffer();
  37.  
  38. String ids = request.getParameter("ids");
  39.  
  40. String publishedKeys = request.getParameter("publishedKeys");
  41.  
  42. sb.append("<result>");
  43.  
  44. if(null != publishedKeys && publishedKeys.indexOf("tcm:") != -1){
  45. ComponentPresentationAssembler cpa = new ComponentPresentationAssembler(publicationId);
  46. if (cpa != null) {
  47. String contentXml = cpa.getContent(publishedKeys, templateUri);
  48. contentXml = contentXml.replace("<tcm:Title>","<tcm:id>"+publishedKeys+"</tcm:id><tcm:Title>");
  49. sb.append(contentXml);
  50. }
  51. }else if((null != publishedKeys && publishedKeys.trim().length() > 0) || (null != ids && ids.trim().length() > 0)){
  52. if(null != ids && ids.trim().length() > 0){
  53. key = "id";
  54. values = ids.split(",");
  55. } else if(null != publishedKeys && publishedKeys.trim().length() > 0){
  56. key = "publishedKey";
  57. values = publishedKeys.split(",");
  58. }
  59.  
  60. Criteria customKeyCriteria = new CustomMetaKeyCriteria(key);
  61. ArrayList<CustomMetaValueCriteria> criteriaList = new ArrayList<CustomMetaValueCriteria>();
  62.  
  63. for (String value : values) {
  64. if(key.equals("id")){
  65. criteriaList.add(new CustomMetaValueCriteria(new Float(value)));
  66. }else{
  67. criteriaList.add(new CustomMetaValueCriteria(value));
  68. }
  69. }
  70.  
  71. Criteria customValueCriteria = new OrCriteria(criteriaList.toArray(new Criteria[values.length]));
  72.  
  73. Query query = new Query(new AndCriteria(customKeyCriteria, customValueCriteria));
  74. String[] result = query.executeQuery(); // This always returns null, so the next step throws a NullPointerException
  75.  
  76. for (String uri : result) {
  77.  
  78. String[] tcmIdArr = uri.split("-");
  79.  
  80. ComponentPresentationAssembler cpa = new ComponentPresentationAssembler(publicationId);
  81. String tcmKey = tcmIdArr[0].replaceAll("tcm:", "")+tcmIdArr[2]+tcmIdArr[1];
  82. //out.println(String.format("tcmKey " + tcmKey));
  83.  
  84. boolean validXml= false;
  85. for (String value : values) {
  86. if(value.equals(tcmKey)){
  87. validXml= true;
  88. }
  89. }
  90.  
  91. if (cpa != null) {
  92. String contentXml = cpa.getContent(Integer.parseInt(tcmIdArr[1]), templateId);
  93. contentXml = contentXml.replace("<tcm:Title>","<tcm:id>"+uri+"</tcm:id><tcm:Title>");
  94. sb.append(contentXml);
  95.  
  96. }
  97. }
  98. }
  99. sb.append("</result>");
  100. out.print(sb.toString().replaceAll("d4p1","xlink"));
  101. %>
  102.  
  103. <?xml version="1.0" encoding="UTF-8"?>
  104. <Configuration Version="7.1"
  105. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  106. xsi:noNamespaceSchemaLocation="schemas/cd_storage_conf.xsd">
  107. <Global>
  108. <!--Optional:-->
  109. <ObjectCache Enabled="false"> <!--SDLTC:set to true-->
  110. <!--Optional:-->
  111. <Policy Type="LRU" Class="com.tridion.cache.LRUPolicy">
  112. <!--
  113. The maximum size of memory used by the cache. The string must consist a number
  114. followed by units: "k" or "kb" for kilobytes; "m" or "mb" for megabytes (case insensitive)
  115. -->
  116. <Param Name="MemSize" Value="64mb"/>
  117. </Policy>
  118.  
  119. <!--Optional:-->
  120. <!-- The Features element specifies classes that add additional functionality to the cache. -->
  121. <Features>
  122. <Feature Type="DependencyTracker" Class="com.tridion.cache.DependencyTracker"/>
  123. </Features>
  124.  
  125. </ObjectCache>
  126.  
  127. <Storages>
  128. <!--
  129. Optional
  130. Overriding default Tridion dao bundles.
  131. -->
  132. <StorageBindings>
  133. <Bundle src="preview_dao_bundle.xml"/>
  134. <!-- <Bundle src="myDAO.xml"/>
  135. <Bundle src="mybindings.xml"/>
  136. -->
  137. </StorageBindings>
  138.  
  139.  
  140. <Wrappers>
  141. <!--
  142. In order to allow storing of the session data a mechanism should be in place to support storing and
  143. retrieving data in a specific user session.
  144. -->
  145.  
  146. <Wrapper Name="SessionWrapper">
  147.  
  148. <Storage Type="persistence" Class="com.tridion.storage.persistence.JPADAOFactory" dialect="MSSQL" Id="TRIDIONBROKER_SESSION" JNDIName="java:comp/env/jdbc/TRIDIONBROKER_SESSION"/> <!--SDLTC-->
  149.  
  150. </Wrapper>
  151. </Wrappers>
  152.  
  153.  
  154. <Storage Type="persistence" Class="com.tridion.storage.persistence.JPADAOFactory" dialect="MSSQL" Id="TRIDIONBROKER_STAGE" JNDIName="java:comp/env/jdbc/TRIDIONBROKER_STAGE"/> <!--SDLTC-->
  155.  
  156. <!--SDLTC-->
  157. <Storage Type="filesystem" Class="com.tridion.storage.filesystem.FSDAOFactory" Id="defaultFile" defaultFilesystem="false">
  158. <Root Path="/jsp-provider/incoming" />
  159. </Storage>
  160. <Storage Type="filesystem" Class="com.tridion.storage.filesystem.FSDAOFactory" Id="defaultDataFile" defaultFilesystem="true" defaultStorage="true">
  161. <Root Path="/jsp-provider/incoming/data" />
  162. </Storage>
  163.  
  164. </Storages>
  165.  
  166. </Global>
  167.  
  168. <ItemTypes defaultStorageId="TRIDIONBROKER_STAGE" cached="false"> <!--SDLTC-->
  169.  
  170. <Item typeMapping="Page" storageId="defaultFile" cached="false"/> <!--SDLTC-->
  171. <Item typeMapping="Page" storageId="TRIDIONBROKER_STAGE" itemExtension=".json" cached="false"/> <!--SDLTC-->
  172. <Item typeMapping="Binary" storageId="defaultFile" cached="false"/> <!--SDLTC-->
  173.  
  174. </ItemTypes>
  175.  
  176.  
  177. <License Location="/staging/cd_licenses.xml"/> <!--SDLTC-->
  178.  
  179. </Configuration>
  180.  
  181. <?xml version="1.0" encoding="UTF-8"?>
  182. <!--
  183. Licensed to the Apache Software Foundation (ASF) under one or more
  184. contributor license agreements. See the NOTICE file distributed with
  185. this work for additional information regarding copyright ownership.
  186. The ASF licenses this file to You under the Apache License, Version 2.0
  187. (the "License"); you may not use this file except in compliance with
  188. the License. You may obtain a copy of the License at
  189.  
  190. http://www.apache.org/licenses/LICENSE-2.0
  191.  
  192. Unless required by applicable law or agreed to in writing, software
  193. distributed under the License is distributed on an "AS IS" BASIS,
  194. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  195. See the License for the specific language governing permissions and
  196. limitations under the License.
  197. -->
  198. <!-- The contents of this file will be loaded for each web application -->
  199. <Context>
  200.  
  201. <!-- Default set of monitored resources. If one of these changes, the -->
  202. <!-- web application will be reloaded. -->
  203. <WatchedResource>WEB-INF/web.xml</WatchedResource>
  204. <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
  205.  
  206. <!-- Uncomment this to disable session persistence across Tomcat restarts -->
  207. <!--
  208. <Manager pathname="" />
  209. -->
  210. <Resource name="jdbc/TRIDIONBROKER_STAGE" auth="Container" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
  211. type="javax.sql.DataSource" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
  212. url="jdbc:sqlserver://database1:10433;database=BROKER_LIVE_SAND_EVO;"
  213. username="BrokerUser_Live_Sand" password="secret" maxActive="100" maxIdle="30"
  214. maxWait="30000" validationQuery="select 1"/>
  215.  
  216. <Resource name="jdbc/TRIDIONBROKER_LIVE" auth="Container" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
  217. type="javax.sql.DataSource" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
  218. url="jdbc:sqlserver://database2:10433;database=BROKER_PREVIEW_SAND_EVO"
  219. username="BrokerUser_Preview_Sand" password="secret" maxActive="100" maxIdle="30"
  220. maxWait="30000" validationQuery="select 1"/>
  221.  
  222. <Resource name="jdbc/TRIDIONBROKER_SESSION" auth="Container" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
  223. type="javax.sql.DataSource" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
  224. url="jdbc:sqlserver://database3.com:10433;database=BROKER_PREVIEW2_SAND_EVO"
  225. username="BrokerUser_Preview2_Sand" password="secret" maxActive="100" maxIdle="30"
  226. maxWait="30000" validationQuery="select 1"/>
  227.  
  228.  
  229. </Context>
  230.  
  231. activation-1.1.jar
  232. antlr-2.7.7.jar
  233. aopalliance-repackaged-2.5.0-b05.jar
  234. asm-3.2.jar
  235. cd_broker-8.5.0-1014.jar
  236. cd_cache-8.5.0-1013.jar
  237. cd_common_config-8.5.0-1009.jar
  238. cd_common_config_api-8.5.0-1009.jar
  239. cd_common_config_legacy-8.5.0-1009.jar
  240. cd_common_util-8.5.0-1009.jar
  241. cd_core-8.5.0-1011.jar
  242. cd_datalayer-8.5.0-1014.jar
  243. cd_dynamic-8.5.0-1014.jar
  244. cd_model-8.5.0-1013.jar
  245. cd_preview_ambient-8.5.0-1013.jar
  246. cd_preview_content_common-8.5.0-1013.jar
  247. cd_preview_webservice-8.5.0-1013.jar
  248. cd_session-8.5.0-1013.jar
  249. cd_wrapper-8.5.0-1014.jar
  250. classmate-1.3.1.jar
  251. commons-lang-2.6.jar
  252. content-v2-odata-8.5.0-1013.jar
  253. dom4j-1.6.1.jar
  254. easylicense-2.5.jar
  255. geronimo-jta_1.1_spec-1.1.1.jar
  256. hibernate-commons-annotations-5.0.1.Final.jar
  257. hibernate-core-5.2.3.Final.jar
  258. hibernate-jpa-2.1-api-1.0.0.Final.jar
  259. javassist-3.20.0-GA.jar
  260. jboss-logging-3.3.0.Final.jar
  261. jcl-over-slf4j-1.7.12.jar
  262. logback-classic-1.1.7.jar
  263. logback-core-1.1.7.jar
  264. ojdbc6.jar
  265. ojdbc7-12.1.0.2.jar
  266. slf4j-api-1.7.12.jar
  267. spring-aop-4.3.3.RELEASE.jar
  268. spring-beans-4.3.3.RELEASE.jar
  269. spring-context-4.3.3.RELEASE.jar
  270. spring-context-support-4.3.3.RELEASE.jar
  271. spring-core-4.3.3.RELEASE.jar
  272. spring-data-commons-1.12.2.RELEASE.jar
  273. spring-data-jpa-1.10.2.RELEASE.jar
  274. spring-expression-4.3.3.RELEASE.jar
  275. spring-integration-core-4.3.2.RELEASE.jar
  276. spring-integration-jms-4.3.2.RELEASE.jar
  277. spring-jdbc-4.3.3.RELEASE.jar
  278. spring-jms-4.3.3.RELEASE.jar
  279. spring-messaging-4.3.3.RELEASE.jar
  280. spring-orm-4.3.3.RELEASE.jar
  281. spring-plugin-core-1.2.0.RELEASE.jar
  282. spring-plugin-metadata-1.2.0.RELEASE.jar
  283. spring-retry-1.1.4.RELEASE.jar
  284. spring-tx-4.3.3.RELEASE.jar
  285. spring-web-4.3.3.RELEASE.jar
  286. spring-webmvc-4.3.3.RELEASE.jar
  287. sqljdbc4-6.0.jar
  288. stax-api-1.0-2.jar
  289. web-ambient-client-8.5.0-1010.jar
  290.  
  291. chmod +r cd_licenses.xml
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement