本文整理汇总了Java中javax.jcr.Property.getString方法的典型用法代码示例。如果您正苦于以下问题:Java Property.getString方法的具体用法?Java Property.getString怎么用?Java Property.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.jcr.Property
的用法示例。
在下文中一共展示了Property.getString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRealValue
import javax.jcr.Property; //导入方法依赖的package包/类
public Object getRealValue(Property property) throws ValueFormatException,
RepositoryException {
Object value = null;
switch (property.getType()) {
case PropertyType.BOOLEAN:
value = property.getBoolean();
break;
case PropertyType.DATE:
value = property.getDate().getTime();
break;
case PropertyType.STRING:
value = property.getString();
break;
case PropertyType.LONG:
value = property.getLong();
break;
case PropertyType.DECIMAL:
value = property.getDecimal();
break;
default:
value = null;
}
return value;
}
示例2: setNodeName
import javax.jcr.Property; //导入方法依赖的package包/类
/**
* Set the node Name. Node name is set to: <br>
* the value of the property 'name' if it is present.
*/
protected void setNodeName(Node node, JcrNodeAdapter item) throws RepositoryException {
String propertyName = "name";
if (node.hasProperty(propertyName) && !node.hasProperty(ModelConstants.JCR_NAME)) {
Property property = node.getProperty(propertyName);
String newNodeName = property.getString();
if (!node.getName().equals(Path.getValidatedLabel(newNodeName))) {
newNodeName = Path.getUniqueLabel(node.getSession(), node.getParent().getPath(), Path.getValidatedLabel(newNodeName));
item.setNodeName(newNodeName);
NodeUtil.renameNode(node, newNodeName);
}
}
}
示例3: getFromStore
import javax.jcr.Property; //导入方法依赖的package包/类
@Override
protected String getFromStore(String... itemIds) throws Exception {
ObjectContentManager ocm = this.ocmFactory.getOcm();
Node node = ocm.getSession().getNode(String.format(URI.RESOURCE_URI, (Object[])itemIds));
Property property = node.getProperty("resource");
String resource = property.getString();
ocm.logout();
return resource;
}
示例4: readStringProperty
import javax.jcr.Property; //导入方法依赖的package包/类
public static String readStringProperty(final Node node, final String name) throws RepositoryException {
if (node.hasProperty(name)) {
final Property property = node.getProperty(name);
return property.getString();
}
return null;
}
示例5: printAttributes
import javax.jcr.Property; //导入方法依赖的package包/类
private void printAttributes( final int indentLevel,
final Node node ) throws RepositoryException {
String maxOccurs = null;
for ( final PropertyIterator iter = node.getProperties(); iter.hasNext(); ) {
final Property prop = iter.nextProperty();
final String name = prop.getName();
if ( name.equals( XsdLexicon.NC_NAME ) ) printAttribute( "name", prop.getString() );
else if ( name.equals( XsdLexicon.TYPE_NAME ) ) {
printAttribute( "type",
namespacePrefixByUri.get( node.getProperty( XsdLexicon.TYPE_NAMESPACE ).getString() )
+ prop.getString() );
} else if ( name.equals( XsdLexicon.MIN_OCCURS ) ) {
if ( prop.getLong() != 1 ) printAttribute( "minOccurs", prop.getString() );
maxOccurs = "unbounded";
} else if ( name.equals( XsdLexicon.MAX_OCCURS ) ) {
if ( prop.getLong() != 1 ) printAttribute( "maxOccurs", prop.getString() );
maxOccurs = null;
} else if ( name.equals( XsdLexicon.USE ) ) {
if ( !prop.getString().equals( "optional" ) ) printAttribute( "use", prop.getString() );
} else if ( name.startsWith( "xmlns" ) ) printAttribute( name, prop.getString() );
else if ( name.equals( XsdLexicon.NAMESPACE ) ) {
if ( !prop.getString().equals( targetNamespace ) ) printAttribute( "namespace", prop.getString() );
}
else if ( name.equals( XsdLexicon.SCHEMA_LOCATION ) ) printAttribute( "schemaLocation", prop.getString() );
else if ( name.equals( "targetNamespace" ) ) {
targetNamespace = prop.getString();
printAttribute( name, targetNamespace );
}
}
if ( maxOccurs != null ) printAttribute( "maxOccurs", maxOccurs );
}
示例6: getProperty
import javax.jcr.Property; //导入方法依赖的package包/类
private String getProperty(Node n, String property) throws PathNotFoundException, RepositoryException {
Property p = n.getProperty(property);
if(p != null) {
return p.getString();
} else {
return null;
}
}
示例7: getNodeProperty
import javax.jcr.Property; //导入方法依赖的package包/类
private String getNodeProperty(Node node, String propertyString,
String defaultString) {
try {
Property prop = node.getProperty(propertyString);
if (prop == null)
return defaultString;
return prop.getString();
} catch (Exception ex) {
return defaultString;
}
}
开发者ID:Adobe-Marketing-Cloud,项目名称:experiencemanager-workflow-samples,代码行数:12,代码来源:TranslatorImpl.java
示例8: distill
import javax.jcr.Property; //导入方法依赖的package包/类
/**
* Extract property based on their type and return as object (of Property)
*
* @param property This is a property
* @return content This is node property object
* @throws Exception
*/
public static Object distill(Property property)
throws Exception {
Object content;
boolean isMulti = property.isMultiple();
switch (property.getType()) {
case PropertyType.LONG:
if (isMulti)
content = asLongs(property);
else
content = property.getLong();
break;
case PropertyType.DECIMAL:
case PropertyType.DOUBLE:
if (isMulti)
content = asDoubles(property);
else
content = property.getDouble();
break;
case PropertyType.BOOLEAN:
if (isMulti)
content = asBooleans(property);
else
content = property.getBoolean();
break;
case PropertyType.DATE:
if (isMulti)
content = asDates(property);
else
content = property.getValue().getString();
break;
case PropertyType.NAME:
case PropertyType.STRING:
case PropertyType.PATH:
case PropertyType.URI:
default:
if (isMulti)
content = asStrings(property);
else
content = property.getString();
break;
}
return content;
}
示例9: getPropertyString
import javax.jcr.Property; //导入方法依赖的package包/类
/**
* Convenience method for getting a single-value String property from a resource.
*
* @param resource The resource from which to get the property.
* @param namePattern Property name.
* @return Property value.
*/
public static String getPropertyString(Resource resource, String namePattern) throws RepositoryException {
Property prop = getProperty(resource, namePattern);
return prop != null ? prop.getString() : null;
}