当前位置: 首页>>代码示例>>Java>>正文


Java Property.getLong方法代码示例

本文整理汇总了Java中javax.jcr.Property.getLong方法的典型用法代码示例。如果您正苦于以下问题:Java Property.getLong方法的具体用法?Java Property.getLong怎么用?Java Property.getLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.jcr.Property的用法示例。


在下文中一共展示了Property.getLong方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:cheetah100,项目名称:gravity,代码行数:26,代码来源:CardToolsImpl.java

示例2: getIdFromRepository

import javax.jcr.Property; //导入方法依赖的package包/类
/**
 * This method 
 * @param session
 * @param path
 * @return
 * @throws Exception
 */
public synchronized static Long getIdFromRepository( Session session, String path, String id) throws Exception {
	Long returnId = null;
	//LockManager lockManager = session.getWorkspace().getLockManager();
	try{
		//Lock lock = lockManager.lock(path, false, false, 30000l, "");
		//Node node = lock.getNode();
		Node node = session.getNode(path);
						
		try {
			Property property = node.getProperty(id);
			returnId = property.getLong();
		} catch (PathNotFoundException e) {
			returnId = 10001l;
		}
		
		node.setProperty(id, returnId+1);
		session.save();
				
	} finally { 
		//lockManager.unlock(path);
	}

	return returnId;
}
 
开发者ID:cheetah100,项目名称:gravity,代码行数:32,代码来源:IdentifierTools.java

示例3: readIntProperty

import javax.jcr.Property; //导入方法依赖的package包/类
@SuppressWarnings("NumericCastThatLosesPrecision")
public static int readIntProperty(final Node node, final String name) throws RepositoryException {
    if (node.hasProperty(name)) {
        final Property property = node.getProperty(name);
        final long aLong = property.getLong();
        return (int) aLong;
    }
    return 0;
}
 
开发者ID:machak,项目名称:intelij-hippo-groovy,代码行数:10,代码来源:Util.java

示例4: 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 );
}
 
开发者ID:Polyglotter,项目名称:chrysalix,代码行数:32,代码来源:XsdExporter.java

示例5: 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;
}
 
开发者ID:DantaFramework,项目名称:AEM,代码行数:51,代码来源:PropertyUtils.java

示例6: getPropertyLong

import javax.jcr.Property; //导入方法依赖的package包/类
/**
 * Conventience method for getting a single-value Long property from a resource.
 * @param resource The resource from which to get the property.
 * @param namePattern Property name.
 * @return Property value.
 */
public static Long getPropertyLong(Resource resource, String namePattern) throws RepositoryException {
    Property prop = getProperty(resource, namePattern);
    return prop != null ? prop.getLong() : null;
}
 
开发者ID:HS2-SOLUTIONS,项目名称:hs2-aem-commons,代码行数:11,代码来源:ResourceUtil.java


注:本文中的javax.jcr.Property.getLong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。