本文整理匯總了Java中org.dom4j.Attribute.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java Attribute.getValue方法的具體用法?Java Attribute.getValue怎麽用?Java Attribute.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.dom4j.Attribute
的用法示例。
在下文中一共展示了Attribute.getValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getOptimisticLockMode
import org.dom4j.Attribute; //導入方法依賴的package包/類
private static int getOptimisticLockMode(Attribute olAtt) throws MappingException {
if (olAtt==null) return Versioning.OPTIMISTIC_LOCK_VERSION;
String olMode = olAtt.getValue();
if ( olMode==null || "version".equals(olMode) ) {
return Versioning.OPTIMISTIC_LOCK_VERSION;
}
else if ( "dirty".equals(olMode) ) {
return Versioning.OPTIMISTIC_LOCK_DIRTY;
}
else if ( "all".equals(olMode) ) {
return Versioning.OPTIMISTIC_LOCK_ALL;
}
else if ( "none".equals(olMode) ) {
return Versioning.OPTIMISTIC_LOCK_NONE;
}
else {
throw new MappingException("Unsupported optimistic-lock style: " + olMode);
}
}
示例2: getVersionName
import org.dom4j.Attribute; //導入方法依賴的package包/類
/**
* Update the plug-in's minSdkVersion and targetSdkVersion
*
* @param androidManifestFile
* @throws IOException
* @throws DocumentException
*/
public static String getVersionName(File androidManifestFile) throws IOException, DocumentException {
SAXReader reader = new SAXReader();
String versionName = "";
if (androidManifestFile.exists()) {
Document document = reader.read(androidManifestFile);// Read the XML file
Element root = document.getRootElement();// Get the root node
if ("manifest".equalsIgnoreCase(root.getName())) {
List<Attribute> attributes = root.attributes();
for (Attribute attr : attributes) {
if (StringUtils.equalsIgnoreCase(attr.getName(), "versionName")) {
versionName = attr.getValue();
}
}
}
}
return versionName;
}
示例3: getClassTableName
import org.dom4j.Attribute; //導入方法依賴的package包/類
private static String getClassTableName(
PersistentClass model,
Element node,
String schema,
String catalog,
Table denormalizedSuperTable,
Mappings mappings) {
Attribute tableNameNode = node.attribute( "table" );
String logicalTableName;
String physicalTableName;
if ( tableNameNode == null ) {
logicalTableName = StringHelper.unqualify( model.getEntityName() );
physicalTableName = getNamingStrategyDelegate( mappings ).determineImplicitPrimaryTableName(
model.getEntityName(),
model.getJpaEntityName()
);
}
else {
logicalTableName = tableNameNode.getValue();
physicalTableName = getNamingStrategyDelegate( mappings ).toPhysicalTableName( logicalTableName );
}
mappings.addTableBinding( schema, catalog, logicalTableName, physicalTableName, denormalizedSuperTable );
return physicalTableName;
}
示例4: getOptimisticLockStyle
import org.dom4j.Attribute; //導入方法依賴的package包/類
private static OptimisticLockStyle getOptimisticLockStyle(Attribute olAtt) throws MappingException {
if ( olAtt == null ) {
return OptimisticLockStyle.VERSION;
}
final String olMode = olAtt.getValue();
if ( olMode == null || "version".equals( olMode ) ) {
return OptimisticLockStyle.VERSION;
}
else if ( "dirty".equals( olMode ) ) {
return OptimisticLockStyle.DIRTY;
}
else if ( "all".equals( olMode ) ) {
return OptimisticLockStyle.ALL;
}
else if ( "none".equals( olMode ) ) {
return OptimisticLockStyle.NONE;
}
else {
throw new MappingException( "Unsupported optimistic-lock style: " + olMode );
}
}
示例5: getScopeUrl
import org.dom4j.Attribute; //導入方法依賴的package包/類
/**
* Gets the URL to the collection's scope statement.
*
* @return The URL to the collection's scope statement, or null if none.
* @exception Exception If error
*/
protected String getScopeUrl() throws Exception {
List nodes = getDom4jDoc().selectNodes("/*[local-name()='collectionRecord']/*[local-name()='general']/*[local-name()='policies']/*[local-name()='policy'][@type='Collection scope']/@url");
if (nodes == null || nodes.size() == 0)
return null;
Attribute attrib = (Attribute) nodes.get(0);
return attrib.getValue();
}
示例6: getReviewProcessUrl
import org.dom4j.Attribute; //導入方法依賴的package包/類
/**
* Gets the URL to the collection's review process statement.
*
* @return The URL to the collection's review process statement.
* @exception Exception If error
*/
protected String getReviewProcessUrl() throws Exception {
List nodes = getDom4jDoc().selectNodes("/*[local-name()='collectionRecord']/*[local-name()='general']/*[local-name()='reviewProcess']/@url");
if (nodes.size() > 1)
prtln("More than one review process URL!");
if (nodes.size() == 0)
return null;
Attribute attrib = (Attribute) nodes.get(0);
return attrib.getValue();
}
示例7: add
import org.dom4j.Attribute; //導入方法依賴的package包/類
public void add(XmlDocument metadataXml) {
final Document document = metadataXml.getDocumentTree();
final Element hmNode = document.getRootElement();
Attribute packNode = hmNode.attribute( "package" );
String defaultPackage = packNode != null ? packNode.getValue() : "";
Set<String> entityNames = new HashSet<String>();
findClassNames( defaultPackage, hmNode, entityNames );
for ( String entity : entityNames ) {
hbmMetadataByEntityNameXRef.put( entity, metadataXml );
}
this.hbmMetadataToEntityNamesMap.put( metadataXml, entityNames );
}
示例8: getClassName
import org.dom4j.Attribute; //導入方法依賴的package包/類
private String getClassName(Attribute name, String defaultPackage) {
if ( name == null ) {
return null;
}
String unqualifiedName = name.getValue();
if ( unqualifiedName == null ) {
return null;
}
if ( unqualifiedName.indexOf( '.' ) < 0 && defaultPackage != null ) {
return defaultPackage + '.' + unqualifiedName;
}
return unqualifiedName;
}
示例9: bindImport
import org.dom4j.Attribute; //導入方法依賴的package包/類
private static void bindImport(Element importNode, Mappings mappings) {
String className = getClassName( importNode.attribute( "class" ), mappings );
Attribute renameNode = importNode.attribute( "rename" );
String rename = ( renameNode == null ) ?
StringHelper.unqualify( className ) :
renameNode.getValue();
LOG.debugf( "Import: %s -> %s", rename, className );
mappings.addImport( className, rename );
}
示例10: bindOneToOne
import org.dom4j.Attribute; //導入方法依賴的package包/類
public static void bindOneToOne(Element node, OneToOne model, boolean isNullable, Mappings mappings) throws MappingException {
//bindColumns(node, model, isNullable, false, null, mappings);
initOuterJoinFetchSetting(node, model);
Attribute constrNode = node.attribute("constrained");
boolean constrained = constrNode!=null && constrNode.getValue().equals("true");
model.setConstrained(constrained);
model.setForeignKeyType(
constrained ?
ForeignKeyDirection.FOREIGN_KEY_FROM_PARENT :
ForeignKeyDirection.FOREIGN_KEY_TO_PARENT
);
Attribute fkNode = node.attribute("foreign-key");
if (fkNode!=null) model.setForeignKeyName( fkNode.getValue() );
Attribute ukName = node.attribute("property-ref");
if (ukName!=null) model.setReferencedPropertyName( ukName.getValue() );
Attribute classNode = node.attribute("class");
if (classNode!=null) {
try {
model.setType( TypeFactory.oneToOne(
ReflectHelper.classForName( getClassName(classNode, mappings) ),
model.getForeignKeyType(),
model.getReferencedPropertyName()
) );
}
catch (Exception e) {
throw new MappingException( "Could not find class: " + classNode.getValue() );
}
}
}
示例11: bindUniqueKey
import org.dom4j.Attribute; //導入方法依賴的package包/類
private static void bindUniqueKey(Attribute uniqueKeyAttribute, Table table, Column column, Mappings mappings) {
if ( uniqueKeyAttribute != null && table != null ) {
StringTokenizer tokens = new StringTokenizer( uniqueKeyAttribute.getValue(), ", " );
while ( tokens.hasMoreTokens() ) {
table.getOrCreateUniqueKey( tokens.nextToken() ).addColumn( column );
}
}
}
示例12: bindSimpleValueType
import org.dom4j.Attribute; //導入方法依賴的package包/類
private static void bindSimpleValueType(Element node, SimpleValue simpleValue, Mappings mappings)
throws MappingException {
String typeName = null;
Properties parameters = new Properties();
Attribute typeNode = node.attribute( "type" );
if ( typeNode == null ) {
typeNode = node.attribute( "id-type" ); // for an any
}
else {
typeName = typeNode.getValue();
}
Element typeChild = node.element( "type" );
if ( typeName == null && typeChild != null ) {
typeName = typeChild.attribute( "name" ).getValue();
Iterator typeParameters = typeChild.elementIterator( "param" );
while ( typeParameters.hasNext() ) {
Element paramElement = (Element) typeParameters.next();
parameters.setProperty(
paramElement.attributeValue( "name" ),
paramElement.getTextTrim()
);
}
}
resolveAndBindTypeDef(simpleValue, mappings, typeName, parameters);
}
示例13: getTypeFromXML
import org.dom4j.Attribute; //導入方法依賴的package包/類
public static String getTypeFromXML(Element node) throws MappingException {
// TODO: handle TypeDefs
Attribute typeNode = node.attribute( "type" );
if ( typeNode == null ) typeNode = node.attribute( "id-type" ); // for an any
if ( typeNode == null ) return null; // we will have to use reflection
return typeNode.getValue();
}
示例14: parseDOM4J
import org.dom4j.Attribute; //導入方法依賴的package包/類
public static String parseDOM4J(Document doc) {
Element root = doc.getRootElement();
Attribute resultAttr=root.attribute("result");
String result=resultAttr.getValue();
return result;
}
示例15: doSecondPass
import org.dom4j.Attribute; //導入方法依賴的package包/類
public void doSecondPass(Map persistentClasses) throws MappingException {
String queryName = queryElem.attribute( "name" ).getValue();
if (path!=null) queryName = path + '.' + queryName;
boolean cacheable = "true".equals( queryElem.attributeValue( "cacheable" ) );
String region = queryElem.attributeValue( "cache-region" );
Attribute tAtt = queryElem.attribute( "timeout" );
Integer timeout = tAtt == null ? null : Integer.valueOf( tAtt.getValue() );
Attribute fsAtt = queryElem.attribute( "fetch-size" );
Integer fetchSize = fsAtt == null ? null : Integer.valueOf( fsAtt.getValue() );
Attribute roAttr = queryElem.attribute( "read-only" );
boolean readOnly = roAttr != null && "true".equals( roAttr.getValue() );
Attribute cacheModeAtt = queryElem.attribute( "cache-mode" );
String cacheMode = cacheModeAtt == null ? null : cacheModeAtt.getValue();
Attribute cmAtt = queryElem.attribute( "comment" );
String comment = cmAtt == null ? null : cmAtt.getValue();
java.util.List<String> synchronizedTables = new ArrayList<String>();
Iterator tables = queryElem.elementIterator( "synchronize" );
while ( tables.hasNext() ) {
synchronizedTables.add( ( (Element) tables.next() ).attributeValue( "table" ) );
}
boolean callable = "true".equals( queryElem.attributeValue( "callable" ) );
NamedSQLQueryDefinition namedQuery;
Attribute ref = queryElem.attribute( "resultset-ref" );
String resultSetRef = ref == null ? null : ref.getValue();
if ( StringHelper.isNotEmpty( resultSetRef ) ) {
namedQuery = new NamedSQLQueryDefinitionBuilder().setName( queryName )
.setQuery( queryElem.getText() )
.setResultSetRef( resultSetRef )
.setQuerySpaces( synchronizedTables )
.setCacheable( cacheable )
.setCacheRegion( region )
.setTimeout( timeout )
.setFetchSize( fetchSize )
.setFlushMode( FlushMode.interpretExternalSetting( queryElem.attributeValue( "flush-mode" ) ) )
.setCacheMode( CacheMode.interpretExternalSetting( cacheMode ) )
.setReadOnly( readOnly )
.setComment( comment )
.setParameterTypes( HbmBinder.getParameterTypes( queryElem ) )
.setCallable( callable )
.createNamedQueryDefinition();
//TODO check there is no actual definition elemnents when a ref is defined
}
else {
ResultSetMappingDefinition definition = buildResultSetMappingDefinition( queryElem, path, mappings );
namedQuery = new NamedSQLQueryDefinitionBuilder().setName( queryName )
.setQuery( queryElem.getText() )
.setQueryReturns( definition.getQueryReturns() )
.setQuerySpaces( synchronizedTables )
.setCacheable( cacheable )
.setCacheRegion( region )
.setTimeout( timeout )
.setFetchSize( fetchSize )
.setFlushMode( FlushMode.interpretExternalSetting( queryElem.attributeValue( "flush-mode" ) ) )
.setCacheMode( CacheMode.interpretExternalSetting( cacheMode ) )
.setReadOnly( readOnly )
.setComment( comment )
.setParameterTypes( HbmBinder.getParameterTypes( queryElem ) )
.setCallable( callable )
.createNamedQueryDefinition();
}
if ( LOG.isDebugEnabled() ) {
LOG.debugf( "Named SQL query: %s -> %s", namedQuery.getName(), namedQuery.getQueryString() );
}
mappings.addSQLQuery( queryName, namedQuery );
}