小编Pat*_*tan的帖子

如何在Tridion 2011 SP1中使用Core Service创建期间向页面添加组件演示文稿

我正在通过核心服务创建一个页面.我想添加组件演示文稿.

我创建了这样的页面:

var page = new Tridion.ContentManager.CoreService.Client.PageData
{
    Title = "pagecore",
    FileName = "pagecore",
    Id = "tcm:0-0-0",
    LocationInfo = new LocationInfo
    {
        OrganizationalItem = new LinkToOrganizationalItemData { IdRef = "tcm:9-44-4" }
    },
    IsPageTemplateInherited= false,
    PageTemplate=new LinkToPageTemplateData { IdRef = "tcm:9-545-128" }, 
}
Run Code Online (Sandbox Code Playgroud)

我无法向其添加组件演示文稿.

任何人都可以告诉我如何添加组件演示文稿吗?

谢谢.

tridion

3
推荐指数
1
解决办法
637
查看次数

如何从XSLT TBB获取关键字的"密钥"?

我正在研究XSLT TBB(使用Tridion 2011 SP1上的XSLT Mediator)从关键字中检索密钥值.

我的关键字看起来像这样.

Value: Some Value   
Key: Its ID is 123
Run Code Online (Sandbox Code Playgroud)

这是一个普通的关键字.

我创建了一个带有字段的模式.将从"列表"和"类别"中选择值.

组件Source看起来像这样:这是直接从Tridion UI组件中获取的Component源.

<Content xmlns="Some Name space">
    <keywordlink xlink:href="tcm:202-9737-1024" xlink:title="Some Value"
        xmlns:xlink="http://www.w3.org/1999/xlink">Some Value</keywordlink>
</Content>
Run Code Online (Sandbox Code Playgroud)

当我从模板构建器中观察到tcm:Component源时,我发现该字段没有属性.

  <Content xmlns="Some Name space">
    <keywordlink>Some Value</keywordlink>
  </Content>
Run Code Online (Sandbox Code Playgroud)

我想检索关键字的Key值.

我写了这样的XSLT TBB.我正在使用XSLT介体来执行XSLT TBB.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:simple="Some Name space"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:tcm="http://www.tridion.com/ContentManager/5.0"
  xmlns:xh="http://www.w3.org/1999/xhtml" 
  xmlns:i="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns:transform-ext="urn:tridion:transform-ext" 
  xmlns="http://www.w3.org/1999/xhtml" 
  exclude-result-prefixes="#default simple xh">

    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />

    <xsl:template match="/">
        <xsl:apply-templates 
            select="tcm:Component/tcm:Data/tcm:Content/simple:Content" />
    </xsl:template>

    <xsl:template match="simple:Content">
        <xsl:value-of …
Run Code Online (Sandbox Code Playgroud)

xslt tridion tridion-2011

3
推荐指数
1
解决办法
685
查看次数

如何在SDL Tridion中获取任何对象的XML结构

如何在Tridion中获取项目的XML结构(如架构,组件,复合模板,关键字,类别,文件夹等)?

它位于Tridion的安装文件夹中还是其他任何位置?或者有没有办法直接从Tridion UI访问它?

tridion tridion-2011

3
推荐指数
1
解决办法
728
查看次数

识别XSLT中的null元素,即使在子元素中也没有值

检查Null元素

<image><a><img src="abcd"/></a></image>
Run Code Online (Sandbox Code Playgroud)

XSLT模板:

<xsl:if test="image!=''">
IMAGE HAS TEXT OR INNER ELEMENT
</xsl:if>
Run Code Online (Sandbox Code Playgroud)

虽然"image"元素有子元素,但我得到空白输出.理想情况下它不是空的.

我必须检查它应该有值或子元素的条件.子元素可以为空.

如何纠正这一点.

谢谢

xslt xpath xslt-1.0

3
推荐指数
1
解决办法
1731
查看次数

检查字符串长度并附加一个字符以使其长度恒定

<Data>
<AA>123</AA>
  <AA>45658</AA>
  <AA>123456789</AA> 
</Data>
Run Code Online (Sandbox Code Playgroud)

需要的输出:

<info>
  <Numbers id="000000123" />
  <Numbers id="000045658" />
  <Numbers id="123456789" />
</info>
Run Code Online (Sandbox Code Playgroud)

健康)状况:

我需要检查元素 AA 的字符串长度。如果长度小于 9,我需要附加 '0' 以使其长度为 9 位。

XSLT 写道:

<xsl:template match="Data">   
  <info>
       <xsl:for-each select="AA">
              <Numbers>
                <xsl:attribute name="id">
                  <xsl:variable name="numlenght">
                  <xsl:value-of select="string-length(.)" />
                    </xsl:variable>
                  <xsl:choose>
                    <xsl:when test="$numlenght&lt;9">
                      <xsl:variable name="balance">
                        <xsl:value-of select="9-$numlenght"/>
                      </xsl:variable>
                      <xsl:for-each select="//*[position() &lt;$balance]">
                        <xsl:value-of select="'0'"/>
                      </xsl:for-each>

                    </xsl:when>
                                      </xsl:choose>
                  <xsl:value-of select="."/>

                </xsl:attribute>
              </Numbers>
            </xsl:for-each>
  </info>
        </xsl:template>
Run Code Online (Sandbox Code Playgroud)

我没有得到确切的输出。

任何人都可以建议如何做到这一点?

xslt xslt-1.0

3
推荐指数
1
解决办法
4782
查看次数

如何将消息上下文头添加到apache axis 2 Java

我正在从事网络服务.我想知道如何在JAX-WS类型的Web服务中向SOAP请求添加标头.

考虑我的头像这样.

    Map<String, List<String>> headers = new HashMap<String, List<String>>();
    headers.put("Username", Collections.singletonList("aaaa"));
    headers.put("Password", Collections.singletonList("aaaa"));
Run Code Online (Sandbox Code Playgroud)

我的客户端类中有stub对象.我正在使用Apache Axis 2.所有类都是自动生成的.

SimpleSTub stub = new Simplestub();
Run Code Online (Sandbox Code Playgroud)

我想在客户端添加此标头信息.

MessageContext.HTTP_REQUEST_HEADERS, headers
Run Code Online (Sandbox Code Playgroud)

编辑

在普通类中的实际实现发现为

private static final String WS_URL ="http:// localhost:9999/ws/hello?wsdl";

public static void main(String [] args)throws Exception {

URL url =新URL(WS_URL); QName qname = new QName("http://ws.mkyong.com/","HelloWorldImplService");

Service service = Service.create(url, qname);
HelloWorld hello = service.getPort(HelloWorld.class);

/*******************UserName & Password ******************************/
Map<String, Object> req_ctx = ((BindingProvider)hello).getRequestContext();
req_ctx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, WS_URL);

Map<String, List<String>> headers = new HashMap<String, List<String>>();
headers.put("Username", Collections.singletonList("mkyong"));
headers.put("Password", Collections.singletonList("password")); …
Run Code Online (Sandbox Code Playgroud)

java axis2 web-services jax-ws webservice-client

3
推荐指数
1
解决办法
1万
查看次数

优化 Maven 构建性能

我有一个 Maven Web 应用程序。这花费了太多时间来构建(30-40 分钟)。我想将其减少到 10 分钟以内。我的 pom.xml 如下。

<?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">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>se.mysite.etc.settings</groupId>
        <artifactId>projects</artifactId>
        <version>1.5</version>
    </parent>
    <groupId>se.myweb.portal</groupId>
    <artifactId>myweb-se-main</artifactId>
    <name>myweb-se-main</name>
    <version>3.1.81-B2_forv-SNAPSHOT</version>
    <packaging>pom</packaging>
    <inceptionYear>2009</inceptionYear>
    <properties>
        <release.version>${project.version}</release.version>
        <acc.version>2.3.42-TEST-MAINT-SNAPSHOT</acc.version>
        <cxf.version>2.5.3</cxf.version>
        <spring.version>3.0.3.RELEASE</spring.version>
        <spring.security.version>2.0.4</spring.security.version>
        <spring.webflow.version>2.1.1.RELEASE</spring.webflow.version>
        <commonportal.version>1.9.9-SPRING3</commonportal.version>          
        <junit.version>4.5</junit.version>
        <java.source.version>1.6</java.source.version>
        <cobertura.maxmem>1024M</cobertura.maxmem>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <scm>
        <connection>scm:hg:http://test1/myweb</connection>
        <developerConnection>scm:hg:http://test1/myweb</developerConnection>
        <tag/>
        <url>http://test1/myweb</url>
    </scm>
    <profiles>
        <profile>
            <id>dev</id>
            <dependencies>
                <!--some dependencies-->
            </dependencies>
            <modules>
                <module>../project1</module>
                <module>../project2</module>
                <module>../project3</module>
                <module>../project4</module>
            </modules>
        </profile>
        <profile>
            <id>dist</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <dependencies>
                <!--some dependencies-->
            </dependencies>
            <modules>
                <module>../project1</module>
                <module>../project2</module>
                <module>../project3</module>
                <module>../project4</module>
                <module>../project5</module>
                <module>../project6</module>
            </modules>
        </profile> …
Run Code Online (Sandbox Code Playgroud)

maven-3 maven jenkins

3
推荐指数
1
解决办法
5171
查看次数

连接ETIMEDOUT npm grunt模块

我无法安装grunt模块.

C:\Users\maah4>npm install -g grunt-cli
npm http GET https://registry.npmjs.org/grunt-cli
npm http GET https://registry.npmjs.org/grunt-cli
npm http GET https://registry.npmjs.org/grunt-cli
npm ERR! network connect ETIMEDOUT
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settin
gs.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! …
Run Code Online (Sandbox Code Playgroud)

node.js npm gruntjs

3
推荐指数
1
解决办法
6599
查看次数

嵌套循环涉及java 8中的条件

我有一段代码

List<Obj1> result = new ArrayList<Obj1>();
for (Obj1 one : list1) {
            for (Obj2 two : list2) {
                if (one.getStatus() == two) {
                    result.add(one);
                }
            }
        }
Run Code Online (Sandbox Code Playgroud)

在Java 8中使用流我可以像这样写

 list1.stream().forEach(one -> {
        if (list2.stream().anyMatch(two -> one.getStatus() == two)) {
            result.add(one);
        }            
    });
Run Code Online (Sandbox Code Playgroud)

这可以大大简化.

java java-8 java-stream

3
推荐指数
1
解决办法
148
查看次数

JdbcTemplate类型的方法query(String,ResultSetExtractor &lt;T&gt;)不适用于参数(String,BeanPropertyRowMapper)

我有一个奇怪的编译问题。我无法解决此问题。同样的代码在另一个项目中也能正常工作

org.mockito.Mockito.when(jdbcTemplate.query(org.mockito.Matchers.anyString(), 
    org.mockito.Matchers.any(BeanPropertyRowMapper.class))).thenReturn(SOMELIST);
Run Code Online (Sandbox Code Playgroud)

我收到错误消息

The method query(String, ResultSetExtractor<T>) in the type JdbcTemplate is not applicable for the arguments (String, BeanPropertyRowMapper)

但是,当我这样做时,不会出现任何错误。但是我没想到这一点。

BeanPropertyRowMapper<MyClass> mapper = 
    new BeanPropertyRowMapper<MyClass>(MyClass.class);
org.mockito.Mockito.when(jdbcTemplate.query(org.mockito.Matchers.anyString(), 
    mapper)).thenReturn(SOMELIST);
Run Code Online (Sandbox Code Playgroud)

我不确定这是否是Eclipse问题。感谢您的帮助。

java spring mocking junit4 mockito

2
推荐指数
1
解决办法
6162
查看次数