Refine search
public static Element addNativelyGeneratedId( Element parent, String name, String type, boolean useRevisionEntityWithNativeId) { final Element idMapping = parent.addElement( "id" ); idMapping.addAttribute( "name", name ).addAttribute( "type", type ); final Element generatorMapping = idMapping.addElement( "generator" ); if ( useRevisionEntityWithNativeId ) { generatorMapping.addAttribute( "class", "native" ); } else { generatorMapping.addAttribute( "class", "org.hibernate.envers.enhanced.OrderedSequenceGenerator" ); generatorMapping.addElement( "param" ).addAttribute( "name", "sequence_name" ).setText( "REVISION_GENERATOR" ); generatorMapping.addElement( "param" ) .addAttribute( "name", "table_name" ) .setText( "REVISION_GENERATOR" ); generatorMapping.addElement( "param" ).addAttribute( "name", "initial_value" ).setText( "1" ); generatorMapping.addElement( "param" ).addAttribute( "name", "increment_size" ).setText( "1" ); } // generatorMapping.addAttribute("class", "sequence"); // generatorMapping.addElement("param").addAttribute("name", "sequence").setText("custom"); return idMapping; }
/** * Adds <code>formula</code> element. * * @param element Parent element. * @param formula Formula descriptor. */ public static void addFormula(Element element, Formula formula) { element.addElement( "formula" ).setText( formula.getText() ); }
public static Element addProperty( Element parent, String name, String type, boolean insertable, boolean updateable, boolean key) { final Element propMapping; if ( key ) { propMapping = parent.addElement( "key-property" ); } else { propMapping = parent.addElement( "property" ); propMapping.addAttribute( "insert", Boolean.toString( insertable ) ); propMapping.addAttribute( "update", Boolean.toString( updateable ) ); } propMapping.addAttribute( "name", name ); if ( type != null ) { propMapping.addAttribute( "type", type ); } return propMapping; }
private void mapEnumerationType(Element parent, Type type, Properties parameters) { if ( parameters.getProperty( EnumType.ENUM ) != null ) { parent.addElement( "param" ) .addAttribute( "name", EnumType.ENUM ) .setText( parameters.getProperty( EnumType.ENUM ) ); } else { parent.addElement( "param" ) .addAttribute( "name", EnumType.ENUM ) .setText( type.getReturnedClass().getName() ); } if ( parameters.getProperty( EnumType.NAMED ) != null ) { parent.addElement( "param" ) .addAttribute( "name", EnumType.NAMED ) .setText( parameters.getProperty( EnumType.NAMED ) ); } else { parent.addElement( "param" ) .addAttribute( "name", EnumType.NAMED ) .setText( "" + !( (EnumType) ( (CustomType) type ).getUserType() ).isOrdinal() ); } }
void populateXml(Element materials, Modifications modifications, XmlWriterContext writerContext) { Element materialElement = materials.addElement("material"); materialElement.addAttribute("materialUri", writerContext.getBaseUrl() + "/api/materials/" + material.getId() + ".xml"); for (Map.Entry<String, Object> criterion : material.getAttributesForXml().entrySet()) { if (criterion.getValue() != null) { materialElement.addAttribute(criterion.getKey(), criterion.getValue().toString()); } } Element modificationsTag = materialElement.addElement("modifications"); populateXmlForModifications(modifications, writerContext, modificationsTag); }
private Document endDocument(Project project) { // Save the error information Element errorsElement = root.addElement(ERRORS_ELEMENT_NAME); for (AnalysisError analysisError : bugCollection.getErrors()) { errorsElement.addElement(ANALYSIS_ERROR_ELEMENT_NAME).setText(analysisError.getMessage()); } for (Iterator<String> i = bugCollection.missingClassIterator(); i.hasNext();) { errorsElement.addElement(MISSING_CLASS_ELEMENT_NAME).setText(i.next()); } return document; }
/** * Add BugCode elements. * * @param bugCodeSet * all bug codes (abbrevs) referenced in the BugCollection */ private void addBugCodes(Set<String> bugCodeSet) { Element root = document.getRootElement(); for (String bugCode : bugCodeSet) { Element element = root.addElement("BugCode"); element.addAttribute("abbrev", bugCode); Element description = element.addElement("Description"); description.setText(I18N.instance().getBugTypeDescription(bugCode)); } }
String joinTableValueColumnName, String joinTableValueColumnType) { final Element set = classMapping.addElement( "set" ); set.addAttribute( "name", propertyName ); set.addAttribute( "table", joinTableName ); set.addAttribute( "schema", joinTableSchema ); set.addAttribute( "catalog", joinTableCatalog ); set.addAttribute( "cascade", "persist, delete" ); set.addAttribute( "fetch", "join" ); set.addAttribute( "lazy", "false" ); final Element key = set.addElement( "key" ); key.addAttribute( "column", joinTablePrimaryKeyColumnName ); final Element element = set.addElement( "element" ); element.addAttribute( "type", joinTableValueColumnType ); final Element column = element.addElement( "column" ); column.addAttribute( "name", joinTableValueColumnName );
private Document createDocument(final Reflections reflections) { Store map = reflections.getStore(); Document document = DocumentFactory.getInstance().createDocument(); Element root = document.addElement("Reflections"); for (String indexName : map.keySet()) { Element indexElement = root.addElement(indexName); for (String key : map.get(indexName).keySet()) { Element entryElement = indexElement.addElement("entry"); entryElement.addElement("key").setText(key); Element valuesElement = entryElement.addElement("values"); for (String value : map.get(indexName).get(key)) { valuesElement.addElement("value").setText(value); } } } return document; } }
element.addElement(propName[i]); element.addElement(eleName); element.element(eleName).addAttribute(attName, value); element.addElement(lastName); element.element(lastName).setText(value);
public static Element createJoin( Element parent, String tableName, String schema, String catalog) { final Element joinMapping = parent.addElement( "join" ); joinMapping.addAttribute( "table", tableName ); if ( !StringTools.isEmpty( schema ) ) { joinMapping.addAttribute( "schema", schema ); } if ( !StringTools.isEmpty( catalog ) ) { joinMapping.addAttribute( "catalog", catalog ); } return joinMapping; }
private Document createDocument(final Reflections reflections) { Store map = reflections.getStore(); Document document = DocumentFactory.getInstance().createDocument(); Element root = document.addElement("Reflections"); for (String indexName : map.keySet()) { Element indexElement = root.addElement(indexName); for (String key : map.get(indexName).keySet()) { Element entryElement = indexElement.addElement("entry"); entryElement.addElement("key").setText(key); Element valuesElement = entryElement.addElement("values"); for (String value : map.get(indexName).get(key)) { valuesElement.addElement("value").setText(value); } } } return document; } }
@Override public Presence kickOccupant(JID jid, JID actorJID, String actorNickname, String reason) throws NotAllowedException { // Update the presence with the new role and inform all occupants Presence updatedPresence = changeOccupantRole(jid, MUCRole.Role.none); if (updatedPresence != null) { Element frag = updatedPresence.getChildElement( "x", "http://jabber.org/protocol/muc#user"); // Add the status code 307 that indicates that the user was kicked frag.addElement("status").addAttribute("code", "307"); // Add the reason why the user was kicked if (reason != null && reason.trim().length() > 0) { frag.element("item").addElement("reason").setText(reason); } // Effectively kick the occupant from the room kickPresence(updatedPresence, actorJID, actorNickname); //Inform the other occupants that user has been kicked broadcastPresence(updatedPresence, false); } return updatedPresence; }
@Override void populateXmlForModifications(Modifications modifications, XmlWriterContext writerContext, Element modificationsTag) { for (Modification modification : modifications) { Element changeset = modificationsTag.addElement("changeset"); changeset.addAttribute("changesetUri", ScmMaterial.changesetUrl(modification, writerContext.getBaseUrl(), material.getId())); changeset.addElement("user").addCDATA(modification.getUserDisplayName()); changeset.addElement("checkinTime").addText(DateUtils.formatISO8601(modification.getModifiedTime())); changeset.addElement("revision").addCDATA(modification.getRevision()); changeset.addElement("message").addCDATA(modification.getComment()); } } }
public IQVersionHandler() { super("XMPP Server Version Handler"); info = new IQHandlerInfo("query", "jabber:iq:version"); if (bodyElement == null) { bodyElement = DocumentHelper.createElement(QName.get("query", "jabber:iq:version")); bodyElement.addElement("name").setText(AdminConsole.getAppName()); bodyElement.addElement("version").setText(AdminConsole.getVersionString()); } }
/** * Add BugCategory elements. * * @param bugCategorySet * all bug categories referenced in the BugCollection */ private void addBugCategories(Set<String> bugCategorySet) { Element root = document.getRootElement(); for (String category : bugCategorySet) { Element element = root.addElement("BugCategory"); element.addAttribute("category", category); Element description = element.addElement("Description"); description.setText(I18N.instance().getBugCategoryDescription(category)); BugCategory bc = DetectorFactoryCollection.instance().getBugCategory(category); if (bc != null) { // shouldn't be null String s = bc.getAbbrev(); if (s != null) { Element abbrev = element.addElement("Abbreviation"); abbrev.setText(s); } s = bc.getDetailText(); if (s != null) { Element details = element.addElement("Details"); details.setText(s); } } } }
String customWrite, boolean quoted) { final Element columnMapping = parent.addElement( "column" ); columnMapping.addAttribute( "name", quoted ? "`" + name + "`" : name ); if ( length != null ) { columnMapping.addAttribute( "length", length.toString() ); columnMapping.addAttribute( "scale", Integer.toString( scale ) );
@Override public IQ handleIQ(IQ packet) { IQ response = IQ.createResultIQ(packet); Element timeElement = DocumentHelper.createElement(QName.get(info.getName(), info.getNamespace())); timeElement.addElement("tzo").setText(formatsTimeZone(TimeZone.getDefault())); timeElement.addElement("utc").setText(getUtcDate(new Date())); response.setChildElement(timeElement); return response; }
private void applyNestedType(SimpleValue value, Element propertyMapping) { final Properties typeParameters = value.getTypeParameters(); final Element typeMapping = propertyMapping.addElement( "type" ); final String typeName = getBasicTypeName( value.getType() ); typeMapping.addAttribute( "name", typeName ); if ( isEnumType( value.getType(), typeName ) ) { // Proper handling of enumeration type mapEnumerationType( typeMapping, value.getType(), typeParameters ); } else { // By default copying all Hibernate properties for ( Object object : typeParameters.keySet() ) { final String keyType = (String) object; final String property = typeParameters.getProperty( keyType ); if ( property != null ) { typeMapping.addElement( "param" ).addAttribute( "name", keyType ).setText( property ); } } } }
@Override void populateXmlForModifications(Modifications modifications, XmlWriterContext writerContext, Element modificationsTag) { Modification firstModification = modifications.first(); Element changeset = modificationsTag.addElement("changeset"); String revision = firstModification.getRevision(); changeset.addAttribute("changesetUri", StageXmlViewModel.httpUrlFor(writerContext.getBaseUrl(), writerContext.stageIdForLocator(revision))); changeset.addElement("checkinTime").addText(DateUtils.formatISO8601(firstModification.getModifiedTime())); changeset.addElement("revision").addText(revision); } }