SharePoint > Custom Page-Library & PageLayout - sharepoint

I have a custom page-library which a custom content-type and a page-layout all inside a site-definition.
Works as expected. The only thing I cannot get around is that if I upgrade the solution with the page-lib, ctype, page-layout via stsadm everything is updated except the page-layout.
New fields in the ctype --> no problem
Changed views in the page-lib --> no problem
Updated PageLayout --> ERROR
The page-layout section:
<!-- specific page-layout to display LKW data -->
<File Url="CustomPage.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" >
<Property Name="Title" Value="$Resources:CustomLayouts,Title;" />
<Property Name="MasterPageDescription"
Value="$Resources:cmscore,PageLayout_BlankWebPartPage_Description;" />
<Property Name="ContentType"
Value="$Resources:cmscore,contenttype_pagelayout_name;" />
<Property Name="PublishingPreviewImage"
Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/BlankWebPartPage.png, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/BlankWebPartPage.png" />
<Property Name="PublishingAssociatedContentType"
Value=";#$Resources:FieldsCTypes,cTypeDisplayName;;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900D38AAFB8072F441984BC947D49503947;#" />
</File>
The relevant section in the onet.xml:
<Module Name="Home" Url="$Resources:cmscore,List_Pages_UrlName;Custom" Path="">
<File Url="Default.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE">
<Property Name="Title"
Value="$Resources:Layouts,DisplayName;" />
<Property Name="ContentType"
Value="$Resources:cmscore,contenttype_welcomepage_name;"/>
<Property Name="PublishingPageLayout"
Value="~SiteCollection/_catalogs/masterpage/CustomPage.aspx, $Resources:PalfingerPlatformsOrderRoot,LKWpageDefaultTitle;" />
<Property Name="PublishingPageContent"
Value="" />
</File>
</Module>
The strange thing is, if I just have a page-layout with no underlying page-library I can update the page-ayout.
The problem only occurs if I use a custom page-layout inside a custom page-library.
I did some Google search and found a hint - the problem could be that the page-layout is unghosted.
I checked this with a small sample code:
SPFile file = folder.Files["Default.aspx"];
if (file.CustomizedPageStatus == SPCustomizedPageStatus.Customized)
{
file.RevertContentStream();
}
After executing the code the Page-Layout is upgraded and uses the new page-layout.
The Problem is that this is no real solution for me because I have approx. 1000 site-collections using the site-def. and the page-layout.
Updating all of them is quite painful. Does anybody know a solution for this?

I would like to comment on one thing. Looks like IgnoreIfAlreadyExists="TRUE" is not working properly refer to this link, may be reverting the value to FALSE should help.
<File Url="CustomPage.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" >

Related

Crawling rules in heritrix, how to load embedded content?

I want heritrix (version 3.4.0 currently) to crawl site.domain/path and load all pages below that but also include needed things to show the pages, like imgages, scripts and such.
According to https://heritrix.readthedocs.io/en/latest/glossary.html heading "Discovery Path", what I want is "Embedded links" - E and maybe Speculative embed - X. I do not want it to follow normal links - L outside my path.
I have been experimenting with the rules and my basic idea is this: (Last matching rule wins according to docs.)
accept all
reject everything outside site.domain/path
accept embedded files (images/css/script/etc)
It works fine to crawl, only pages within that path on the server but it does not load the needed files for the pages.
How to make it load the needed files as well?
Configuration in my job so far:
<bean id="scope" class="org.archive.modules.deciderules.DecideRuleSequence">
<property name="rules">
<list>
<bean class="org.archive.modules.deciderules.AcceptDecideRule" />
<bean class="org.archive.modules.deciderules.NotMatchesListRegexDecideRule">
<property name="decision" value="REJECT"/>
<property name="regexList">
<list>
<value>.*site\.domain/path/.*</value>
</list>
</property>
</bean>
<!-- HOW to accept embedded things here? -->
<!-- Below are some of the "standard" rules set up on a fresh job, it behaves the same with and without them when it comes to not loading embedded stuff -->
<bean class="org.archive.modules.deciderules.TooManyHopsDecideRule">
<!-- <property name="maxHops" value="20" /> -->
</bean>
<!-- ...and REJECT those with suspicious repeating path-segments... -->
<bean class="org.archive.modules.deciderules.PathologicalPathDecideRule">
<!-- <property name="maxRepetitions" value="2" /> -->
</bean>
<!-- ...and REJECT those with more than threshold number of path-segments... -->
<bean class="org.archive.modules.deciderules.TooManyPathSegmentsDecideRule">
<!-- <property name="maxPathDepth" value="20" /> -->
</bean>
<!-- ...but always ACCEPT those marked as prerequisitee for another URI... -->
<bean class="org.archive.modules.deciderules.PrerequisiteAcceptDecideRule">
</bean>
<!-- ...but always REJECT those with unsupported URI schemes -->
<bean class="org.archive.modules.deciderules.SchemeNotInSetDecideRule">
</bean>
</list>
</property>
</bean>
This accepts those containing E or X in the Discovery Path.
<bean class="org.archive.modules.deciderules.HopsPathMatchesRegexDecideRule">
<property name="decision" value="ACCEPT"/>
<property name="regex" value="(E|X)" />
</bean>
PS
Ironic when you spend some hours on something and when you make a question and while making an adjustment on it stumble upon the solution.

Excel cell format from jasper report with spring

We have an inhouse legacy java library to generate reports with jasper+spring and export them to html, pdf or xls.
However excel files have all the cells with the same (no ) format
We have one report where one column is filled with text and there is concern that it could be interpreted as formula with numeric values or some other type of code. Likewise we have strings with leading zeroes that should appear in the report.
I have tried setting JExcelApiExporterParameter.IS_DETECT_CELL_TYPE to true through jasperExportParameters.
The report configuration is done through xml like the following:
<bean id="jasperReportHeader" class="java.lang.String">
<constructor-arg>
<value>
<![CDATA[
<html>
]]>
</value>
</constructor-arg>
</bean>
<bean id="jasperExportParameters" class="java.util.HashMap">
<constructor-arg>
<map>
<entry
key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN"
value="false" />
<entry
key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IMAGES_URI">
<value><![CDATA[utils.jasper?opcion=muestraImagen&image=]]></value>
</entry>
<entry
key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.HTML_HEADER">
<ref bean="jasperReportHeader" />
</entry>
<entry
key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.HTML_FOOTER">
<ref bean="jasperReportFooter" />
</entry>
<entry
key="net.sf.jasperreports.engine.export.JRCsvExporterParameter.FIELD_DELIMITER"
value="|" />
<entry
key="net.sf.jasperreports.engine.export.JExcelApiExporterParameter.IS_DETECT_CELL_TYPE"
value="true" />
</map>
</constructor-arg>
</bean>
<bean id="jasperReportFooter" class="java.lang.String">
<constructor-arg>
<value>
<![CDATA[
</html>
]]>
</value>
</constructor-arg>
</bean>
<!-- REPORTES -->
<bean id="solicitudRevisionView"
class="mx.org.rfe.ife.siirfe.comun.web.spring.views.jasper.CustomJasperReportsMultiFormatView">
<property name="url" value="/WEB-INF/reportes/SOLICITUD_REVISION.jasper" />
<property name="exporterParameters" ref="jasperExportParameters" />
</bean>
How can I tell jasper to format cells with text format?
is it doable at all?
This library is using jasper 4.6.0, but I could migrate if that is what is needed.
Our reports have been edited with iReport 3.7.6.
Jasperreports won't interpret your cells to be formulas unless you tell it that they are so. On the other hand, I guess your exporter parameters are not set properly with the map declaration fed into CustomJasperReportsMultiFormatView. Instead of the map declaration, I'd expect something more like
<bean id="solicitudRevisionView"
class="mx.org.rfe.ife.siirfe.comun.web.spring.views.jasper.CustomJasperReportsMultiFormatView">
<property name="url" value="/WEB-INF/reportes/SOLICITUD_REVISION.jasper" />
<property name="exporterParameters">
<props>
<prop name="net.sf.jasperreports.export.xls.detect.cell.type">true</prop>
</props>
</property>
as the Java constants in your spring xml configuration file, like net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, won't be evaluated unless you do it in a different way.

Spring Batch -- Multi-File-Resource -- Takes same time as single Thread?

I am using Spring Batch for data migration from XML to Oracle Database.
With Single Thread execution, process takes 80-90 Mins to insert 20K users approx.
I want to reduce it to more than half but even using Multi File Resource, I am not able to achieve that.
I have a single XML to be processed so I started simply by adding
task executor and making Reader synchronized but not able to achieve gain.
So what I am doing, I split XML into multiple XMLS and want to try with Multi File Resource. Here is the configuration.
<batch:job id="importJob">
<batch:step id="step1Master">
<batch:partition handler="handler" partitioner="partitioner" />
</batch:step>
</batch:job>
<bean id="handler"
class="org.springframework.batch.core.partition.support.TaskExecutorPartitionHandler">
<property name="taskExecutor" ref="taskExecutor" />
<property name="step" ref="slaveStep" />
<property name="gridSize" value="20" />
</bean>
<batch:step id="slaveStep">
<batch:tasklet transaction-manager="transactionManager"
allow-start-if-complete="true">
<batch:chunk reader="reader" writer="writer"
processor="processor" commit-interval="1000" skip-limit="1500000">
<batch:skippable-exception-classes>
<batch:include class="java.lang.Exception" />
</batch:skippable-exception-classes>
</batch:chunk>
</batch:tasklet>
</batch:step>
<bean id="taskExecutor"
class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="100" />
<property name="maxPoolSize" value="300" />
<property name="allowCoreThreadTimeOut" value="true" />
</bean>
<bean id="partitioner"
class="org.springframework.batch.core.partition.support.MultiResourcePartitioner"
scope="step">
<property name="keyName" value="inputFile" />
<property name="resources"
value="file:/.../*.xml" />
</bean>
<bean id="processor"
class="...Processor"
scope="step" />
<bean id="reader" class="org.springframework.batch.item.xml.StaxEventItemReader"
scope="step">
<property name="fragmentRootElementName" value="user" />
<property name="unmarshaller" ref="userDetailUnmarshaller" />
<property name="resource" value="#{stepExecutionContext[inputFile]}" />
</bean>
My Single XML file contains users around 1000 and I am trying by having 20 files.
I kept commit-interval=1000 as each file has 1000 records to be insert in DB.
Do commit-interval needs to adjusted accordingly?
I am using ORACLE DB, Do I need to do any pool management there.
Current Pool of ORACLE DB configured in JBOSS
Min Pool = 100
Max Pool = 300
I see logging like
17:01:50,553 DEBUG [Writer] (taskExecutor-11) [UserDetailWriter] | user added
17:01:50,683 DEBUG [Writer] (taskExecutor-15) [UserDetailWriter] | user added
17:01:51,093 DEBUG [Writer] (taskExecutor-11) [UserDetailWriter] | user added
17:01:59,795 DEBUG [Writer] (taskExecutor-12) [UserDetailWriter] | user added
17:02:00,385 DEBUG [Writer] (taskExecutor-12) [UserDetailWriter] | user added
17:02:00,385 DEBUG [Writer] (taskExecutor-12) [UserDetailWriter] | user added
It seems multiple threads are being created but still I am not seeing any performance improvement here?
Please suggest what I am doing wrong?
go through this documentation for parallel processing
http://docs.spring.io/spring-batch/trunk/reference/html/scalability.html#scalabilityParallelSteps

Customizing filters for ycommercewebservices using AddOn support (Hybris 5.1)

I'm using addon support in hybris 5.1 to customize ycommercewebservices and I don't see any way to add or modify HTTP filters because web.xml from addon is ignored during synchronizing addon and its target. Any ideas?
You don't customise template extensions. And why is this not on the forum?
Eventually, it was easy - just redeclare filters with the same id as in ycommercewebservices-web-spring.xml, but in your addon-web-spring.xml:
<bean id="baseSiteFilter" class="my.own.SelectBaseSiteFilter" >
<property name="baseSiteFilterExclusions" ref="baseSiteFilterExclusions" />
<property name="configurationService" ref="configurationService" />
<property name="sessionService" ref="sessionService" />
<property name="baseSiteService" ref="baseSiteService" />
</bean>
And if you need to add new filter or exclude default filters, redeclare commerceWebServicesFilterChainList in your addon-web-spring.xml:
<alias name="defaultCommerceWebServicesFilterChainList" alias="commerceWebServicesFilterChainList" />
<util:list id="defaultCommerceWebServicesFilterChainList">
<!-- generic platform filters -->
<ref bean="log4jFilter" />
<ref bean="tenantActivationFilter"/>
<ref bean="sessionFilter"/>
<!-- commerceWebservices filters -->
<ref bean="baseSiteFilter" />
<ref bean="sessionAttributesFilter" />
<!-- Security -->
<ref bean="springSecurityFilterChain"/>
</util:list>
Also don't forget to add following line to project.properties.template before installing addon:
ycommercewebservices.additionalWebSpringConfigs.youroccaddon=classpath:/youroccaddon/web/spring/youroccaddon-web-spring.xml
youroccaddon-web-spring.xml will be added in spring context after ycommercewebservices-web-spring.xml, so it's possible to override beans from ycommercewebservices context.

Provisioning a default.aspx page to use a custom page layout

I have a custom site definition I created that deploys a couple of custom page layouts. Does anyone know what needs to be done so that when a user uses my site definition to create a site, their default.aspx page is created using my custom page layout?
Below is the module section of my site definition:
<Modules>
<Module Name="DefaultHome" Url="$Resources:osrvcore,List_Pages_UrlName;" Path="">
<File Url="default.aspx" Type="GhostableInLibrary" >
<Property Name="Title" Value="Test Home Page" />
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/MyCustomPageLayout.aspx, My Custom PageLayout" />
<Property Name="ContentType" Value="$Resources:cmscore,contenttype_welcomepage_name;" />
<Property Name="PublishingPageContent" Value="Welcome to the My Test Publishing Site" />
</File>
</Module>
</Modules>
In your onet.xml file you need to set the DefaultPageLayout property like below
<!-- Publishing Feature -->
<Feature ID="22A9EF51-737B-4ff2-9346-694633FE4416">
<Properties xmlns="http://schemas.microsoft.com/sharepoint/">
<Property Key="WelcomePageUrl" Value="$Resources:osrvcore,List_Pages_UrlName;/Default.aspx" />
<Property Key="ChromeMasterUrl" Value="~SiteCollection/_catalogs/masterpage/MyMasterPage.master"/>
<Property Key="SimplePublishing" Value="True" />
<Property Key="VersioningOnPages" Value="Major" />
<Property Key="RequireCheckoutOnPages" Value="False" />
<Property Key="AvailablePageLayouts" Value="~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx:~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx"/>
<Property Key="DefaultPageLayout" Value="~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx"/>
<Property Key="AvailableWebTemplates" Value="ENTERWIKIRBKC#2;"/>
<Property Key="AllowSpacesInNewPageName" Value="false"/>
</Properties>
</Feature>
The default.aspx page in SiteDefinition created by VS inherits from webpart page. Make sure that you delete all the code and add the below. This has worked for me.
<%# Page Inherits="Microsoft.SharePoint.Publishing.TemplateRedirectionPage,Microsoft.SharePoint.Publishing,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
<%# Reference VirtualPath="~TemplatePageUrl" %>
<%# Reference VirtualPath="~masterurl/custom.master" %>

Resources