本文整理汇总了Java中javax.jcr.Property.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Property.getName方法的具体用法?Java Property.getName怎么用?Java Property.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.jcr.Property
的用法示例。
在下文中一共展示了Property.getName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createInventory
import javax.jcr.Property; //导入方法依赖的package包/类
private void createInventory(Node webResourceGroup)
throws RepositoryException, PathNotFoundException,
ValueFormatException {
if (webResourceGroup.hasNode(INVENTORY)) {
Node inventoryNode = webResourceGroup.getNode(INVENTORY);
PropertyIterator inventoryPropIt = inventoryNode.getProperties();
while (inventoryPropIt.hasNext()) {
Property currentInventoryProperty = inventoryPropIt
.nextProperty();
if (!currentInventoryProperty.getName().startsWith("jcr:")) {
String inventoryType = currentInventoryProperty.getName();
if (!inventory.containsKey(inventoryType)) {
inventory.put(inventoryType, new ArrayList<String>());
}
List<String> inventoryTypeList = inventory
.get(inventoryType);
Value[] inventoryTypeValues = currentInventoryProperty
.getValues();
for (Value currentValue : inventoryTypeValues) {
inventoryTypeList.add(currentValue.getString());
}
}
}
}
}
示例2: InertProperty
import javax.jcr.Property; //导入方法依赖的package包/类
private InertProperty(Property property)
throws RepositoryException {
type = property.getType();
name = property.getName();
values = (property.isMultiple()) ? Arrays.asList(property.getValues()) : Lists.newArrayList(property.getValue());
nodePath = property.getParent().getPath();
}
示例3: propsToMap
import javax.jcr.Property; //导入方法依赖的package包/类
/**
* Takes an Iterator properties and turns it into map.
*
* @param properties This is a list of Iterator Properties
* @param ignoreSystemNames This is a boolean value to whether ignore system names
* @return content This is a list of Objects of Property
* @throws Exception
*/
public static Map<String, Object> propsToMap(Iterator properties, boolean ignoreSystemNames)
throws Exception {
Map<String, Object> content = new JSONObject();
while (properties.hasNext()) {
Property property = (Property) properties.next(); // This is required so we can take any kind of Iterator, not just PropertyIterator
String propertyName = property.getName();
if (ignoreSystemNames && StringUtils.startsWithAny(propertyName, RESERVED_SYSTEM_NAME_PREFIXES))
continue;
content.put(property.getName(), distill(property));
}
return content;
}
示例4: getName
import javax.jcr.Property; //导入方法依赖的package包/类
/**
* Returns name of the Property or null when property can't be accessed.
*/
public static String getName(Property p) {
try {
return p.getName();
} catch (RepositoryException e) {
return null;
}
}
示例5: createUserFromNode
import javax.jcr.Property; //导入方法依赖的package包/类
private User createUserFromNode(final Node userNode) throws RepositoryException {
User user = new User(NodeNameCodec.decode(userNode.getName()));
user.setPath(userNode.getPath().substring(1));
if (userNode.isNodeType(HippoNodeType.NT_EXTERNALUSER)) {
user.setExternal(true);
}
PropertyIterator pi = userNode.getProperties();
while (pi.hasNext()) {
final Property p = pi.nextProperty();
String name = p.getName();
if (name.startsWith("jcr:")) {
//skip
continue;
} else if (name.equals(PROP_EMAIL) || name.equalsIgnoreCase("email")) {
user.setEmail(p.getString());
} else if (name.equals(PROP_FIRSTNAME) || name.equalsIgnoreCase("firstname")) {
user.setFirstName(p.getString());
} else if (name.equals(PROP_LASTNAME) || name.equalsIgnoreCase("lastname")) {
user.setLastName(p.getString());
} else if (name.equals(HippoNodeType.HIPPO_ACTIVE)) {
user.setActive(p.getBoolean());
} else if (name.equals(PROP_PASSWORD) || name.equals(PROP_PASSKEY) || name.equals(PROP_PREVIOUSPASSWORDS)) {
// do not expose password hash
continue;
} else if (name.equals(PROP_PROVIDER)) {
continue;
} else if (name.equals(PROP_PASSWORDLASTMODIFIED)) {
user.setPasswordLastModified(p.getDate());
} else if (name.equals(PROP_SYSTEM)) {
user.setSystem(p.getBoolean());
}
}
return user;
}
示例6: 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 );
}
示例7: EvolutionEntryImpl
import javax.jcr.Property; //导入方法依赖的package包/类
public EvolutionEntryImpl(Property property, Version version, EvolutionConfig config) {
try {
this.config = config;
this.property = property;
this.type = EvolutionEntryType.PROPERTY;
this.name = property.getName();
this.depth = EvolutionPathUtil.getDepthForPath(property.getPath());
this.version = version;
this.path = property.getParent().getName();
this.value = config.printProperty(property);
this.relativePath = EvolutionPathUtil.getRelativePropertyName(property.getPath());
} catch (Exception e) {
log.error("Could not inititalize VersionEntry", e);
}
}
示例8: CurrentEvolutionEntryImpl
import javax.jcr.Property; //导入方法依赖的package包/类
public CurrentEvolutionEntryImpl(Property property, EvolutionConfig config) {
try {
this.config = config;
this.type = EvolutionEntryType.PROPERTY;
this.name = property.getName();
this.depth = EvolutionPathUtil.getLastDepthForPath(property.getPath());
this.path = property.getParent().getName();
this.value = config.printProperty(property);
} catch (Exception e) {
log.error("Could not inititalize VersionEntry", e);
}
}
示例9: apply
import javax.jcr.Property; //导入方法依赖的package包/类
@Override
public Stream<Triple> apply(final Property p) {
try {
final org.apache.jena.graph.Node subject = translator.convert(p.getParent()).asNode();
final org.apache.jena.graph.Node propPredicate = propertyConverter.convert(p).asNode();
final String propertyName = p.getName();
return iteratorToStream(new PropertyValueIterator(p)).filter(this::valueCanBeConverted).map(v -> {
final org.apache.jena.graph.Node object = valueConverter.convert(v).asNode();
if (object.isLiteral()) {
// unpack the name of the property for information about what kind of literal
final int i = propertyName.indexOf('@');
if (i > 0) {
final LiteralLabel literal = object.getLiteral();
final RDFDatatype datatype = literal.getDatatype();
final String datatypeURI = datatype.getURI();
if (datatypeURI.isEmpty() || datatype.equals(XSDstring)) {
// this is an RDF string literal and could involve an RDF lang tag
final String lang = propertyName.substring(i + 1);
final String lex = literal.getLexicalForm();
return create(subject, propPredicate, createLiteral(lex, lang, datatype));
}
}
}
return create(subject, propPredicate, object);
});
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
}
示例10: getArtifactFromNode
import javax.jcr.Property; //导入方法依赖的package包/类
private ArtifactMetadata getArtifactFromNode( String repositoryId, Node artifactNode )
throws RepositoryException
{
String id = artifactNode.getName();
ArtifactMetadata artifact = new ArtifactMetadata();
artifact.setId( id );
artifact.setRepositoryId( repositoryId == null ? artifactNode.getAncestor(2).getName() : repositoryId );
Node projectVersionNode = artifactNode.getParent();
Node projectNode = projectVersionNode.getParent();
Node namespaceNode = projectNode.getParent();
artifact.setNamespace( namespaceNode.getProperty( "namespace" ).getString() );
artifact.setProject( projectNode.getName() );
artifact.setProjectVersion( projectVersionNode.getName() );
artifact.setVersion( artifactNode.hasProperty( "version" )
? artifactNode.getProperty( "version" ).getString()
: projectVersionNode.getName() );
if ( artifactNode.hasProperty( JCR_LAST_MODIFIED ) )
{
artifact.setFileLastModified( artifactNode.getProperty( JCR_LAST_MODIFIED ).getDate().getTimeInMillis() );
}
if ( artifactNode.hasProperty( "whenGathered" ) )
{
artifact.setWhenGathered( artifactNode.getProperty( "whenGathered" ).getDate().getTime() );
}
if ( artifactNode.hasProperty( "size" ) )
{
artifact.setSize( artifactNode.getProperty( "size" ).getLong() );
}
if ( artifactNode.hasProperty( "md5" ) )
{
artifact.setMd5( artifactNode.getProperty( "md5" ).getString() );
}
if ( artifactNode.hasProperty( "sha1" ) )
{
artifact.setSha1( artifactNode.getProperty( "sha1" ).getString() );
}
for ( Node n : JcrUtils.getChildNodes( artifactNode ) )
{
if ( n.isNodeType( FACET_NODE_TYPE ) )
{
String name = n.getName();
MetadataFacetFactory factory = metadataFacetFactories.get( name );
if ( factory == null )
{
log.error( "Attempted to load unknown project version metadata facet: " + name );
}
else
{
MetadataFacet facet = factory.createMetadataFacet();
Map<String, String> map = new HashMap<>();
for ( Property p : JcrUtils.getProperties( n ) )
{
String property = p.getName();
if ( !property.startsWith( "jcr:" ) )
{
map.put( property, p.getString() );
}
}
facet.fromProperties( map );
artifact.addFacet( facet );
}
}
}
return artifact;
}
示例11: getArtifactFromNode
import javax.jcr.Property; //导入方法依赖的package包/类
private ArtifactMetadata getArtifactFromNode( String repositoryId, Node artifactNode )
throws RepositoryException
{
String id = artifactNode.getName();
ArtifactMetadata artifact = new ArtifactMetadata();
artifact.setId( id );
artifact.setRepositoryId( repositoryId == null ? artifactNode.getAncestor( 2 ).getName() : repositoryId );
Node projectVersionNode = artifactNode.getParent();
Node projectNode = projectVersionNode.getParent();
Node namespaceNode = projectNode.getParent();
artifact.setNamespace( namespaceNode.getProperty( "namespace" ).getString() );
artifact.setProject( projectNode.getName() );
artifact.setProjectVersion( projectVersionNode.getName() );
artifact.setVersion( artifactNode.hasProperty( "version" )
? artifactNode.getProperty( "version" ).getString()
: projectVersionNode.getName() );
if ( artifactNode.hasProperty( JCR_LAST_MODIFIED ) )
{
artifact.setFileLastModified( artifactNode.getProperty( JCR_LAST_MODIFIED ).getDate().getTimeInMillis() );
}
if ( artifactNode.hasProperty( "whenGathered" ) )
{
artifact.setWhenGathered( artifactNode.getProperty( "whenGathered" ).getDate().getTime() );
}
if ( artifactNode.hasProperty( "size" ) )
{
artifact.setSize( artifactNode.getProperty( "size" ).getLong() );
}
if ( artifactNode.hasProperty( "md5" ) )
{
artifact.setMd5( artifactNode.getProperty( "md5" ).getString() );
}
if ( artifactNode.hasProperty( "sha1" ) )
{
artifact.setSha1( artifactNode.getProperty( "sha1" ).getString() );
}
for ( Node n : JcrUtils.getChildNodes( artifactNode ) )
{
if ( n.isNodeType( FACET_NODE_TYPE ) )
{
String name = n.getName();
MetadataFacetFactory factory = metadataFacetFactories.get( name );
if ( factory == null )
{
log.error( "Attempted to load unknown project version metadata facet: {}", name );
}
else
{
MetadataFacet facet = factory.createMetadataFacet();
Map<String, String> map = new HashMap<>();
for ( Property p : JcrUtils.getProperties( n ) )
{
String property = p.getName();
if ( !property.startsWith( "jcr:" ) )
{
map.put( property, p.getString() );
}
}
facet.fromProperties( map );
artifact.addFacet( facet );
}
}
}
return artifact;
}
示例12: PageCompareDataLineImpl
import javax.jcr.Property; //导入方法依赖的package包/类
PageCompareDataLineImpl(Property property, String basePath, int depth) throws RepositoryException {
this.path = property.getPath().replace(basePath, "");
this.name = property.getName();
this.value = EvolutionConfig.printProperty(property);
this.depth = depth;
}