Using mybatis generator for classes of db tables, I found that sometimes it introduces newlines into function signatures in the .java files generated, *Example.java and *Mapper.java.
Can this be avoided someway, as it makes very difficult sometimes to check svn modifications?
I used the following configuration:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >
<generatorConfiguration >
<classPathEntry location="myFolder/myDriver.jar"/>
<context id="MyDB" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressDate" value="true" />
</commentGenerator>
<jdbcConnection driverClass="myDriver" connectionURL="myUrl" userId="myUserID" password="myPwd" />
<javaModelGenerator targetPackage="myPackage" targetProject="myProject" >
<property name="enableSubPackages" value="false" />
</javaModelGenerator>
<sqlMapGenerator targetPackage="myMapper" targetProject="myProject">
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<javaClientGenerator targetPackage="myMapper" targetProject="myProject" type="XMLMAPPER">
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<table schema="MY_SCHEMA" tableName="TABLE_TO_GENERATE">
</table>
</context>
</generatorConfiguration>
Related
I want to change the "value" and "defaultValue" of the "drop" that contains "a33"
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<settings version="-1">
<setting id="1" name="a1" value="VAL555" drop="a12" defaultValue="VAL555" default="false" tag="null" />
<setting id="2" name="a2" value="VAL555" drop="a22" defaultValue="VAL555" default="false" tag="null" />
<setting id="3" name="a3" value="VAL555 <== I WANT TO CHANGE THIS" drop="a33" defaultValue="VAL555 <== I WANT TO CHANGE THIS" default="false" tag="null" />
<setting id="4" name="a4" value="VAL555" drop="a44" defaultValue="VAL555" default="false" tag="null" />
<setting id="5" name="a5" value="VAL555" drop="a55" defaultValue="VAL555" default="false" tag="null" />
</settings>
I want to do this for an app in Android Java
Currently, I can't go anywhere.
I have no idea where to start from, or where to look for.
I have a following xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<Abc version="3" xmlns="urn:Abc-v3">
<Ele1>
<SubElement name ="name" description="DO">
<Node version="C" siteURL="https://example.com" />
<Client>
<ClientId>1</ClientId>
<ClientSecret>Yes</ClientSecret>
</Client>
</SubElement>
<SubElement name ="SharePointOLDev1" description="DEV1">
<Node version="C" siteURL="https://example.com" />
<Local>
<LocalId>id</LocalId>
<Password>password</Password>
</Local>
</SubElement>
<SubElement name="AS" description="wow">
<DB connection="connection" />
</SubElement>
</Ele1>
<Ele2>
<Content ID="A" co="LD">
<Description>Simple Docs</Description>
<Serve
Lib1="TEST"
Lib2="yes"
Lib3="yes"
Lib4="no"
Lib5="no"
Lib6="name">
<Hole enabled="false" count="200" />
<Fol enabled="false" count="100" />
<Role enabled="No" validate="false" />
<FetchFilenameAttribute connection="SAP-AS" delay="3" />
</Serve>
</Content>
<Content ID="B" co="OL">
<Description>Simple Docs </Description>
<Serve
Lib1="TEST"
Lib2="yes"
Lib3="yes"
Lib4="no"
Lib5="no"
Lib6="name"">
<Hole enabled="false" count="200" />
<Fol enabled="false" count="100" />
<Role enabled="No" validate="false" />
</Serve>
</Content>
</Ele2>
<Ele3>
<CNode attr="hai" attr1="bye" />
</Ele3>
</Abc>
I need to parse this XML file and assign values to its corresponding class objects.Which is the best option to parse such an xml file.
JAXB sounds good to me but the POJOs were already written by someone and now i will have to rewrite and deploy them.ALso teh xml file has some errors while running xjc command.
DOM approach seems to be very cumbersome n error prone.
Please suggest.
PS:Kindly excuse my beginner level knowledge.
the JDK project comes with SAX(Simple API for XML) accessible by importing org.xml.sax.*.
You may take a look at this https://www.tutorialspoint.com/java_xml/java_sax_parse_document.htm for an introduction to the subject.
I have several .launch files for Eclipse (I'm using Eclipse Oxygen), here is an example
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false" />
<stringAttribute key="M2_GOALS" value="clean com.google.cloud.tools:appengine-maven-plugin:deploy" />
<booleanAttribute key="M2_NON_RECURSIVE" value="false" />
<booleanAttribute key="M2_OFFLINE" value="false" />
<stringAttribute key="M2_PROFILES" value="" />
<listAttribute key="M2_PROPERTIES" />
<stringAttribute key="M2_RUNTIME" value="EMBEDDED" />
<booleanAttribute key="M2_SKIP_TESTS" value="true" />
<intAttribute key="M2_THREADS" value="1" />
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false" />
<stringAttribute key="M2_USER_SETTINGS" value="" />
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false" />
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc}" />
</launchConfiguration>
Note that I'm using ${project_loc} variable in order to make it usable for any project.
I'm using this kind of files because I can share those with my team. Also the most used Maven Build configurations are ready to go w/o configuring every time a new launch profile.
The problem I'm facing is related to the profile value
<stringAttribute key="M2_PROFILES" value="" />
With the CTRL+ALT+P shortcut on a project, I can select the proper profile to load (Select Maven Profiles... function). I'm using different profile to discern the environment for the deploy (development, stage o production).
I'm trying to "inject" the profile I enabled for the project into the generic launch profile configuration, something like the ${project_loc} variable but related to the current Maven profile.
If this cannot be made I need to create a launch profile for each environment, which means 3 files per every goal to launch.
Is there a way to use/create an Eclipse variable that can be resolved with the Maven profile I activated on the project?
Something like
<stringAttribute key="M2_PROFILES" value="${maven.profile.id}" />
You'll need to create an Eclipse plugin (or contribute to Eclipse m2e project) in order to define a variable using the dedicated extension-point.
I have developed Odata service for a system entity which generates a metadata but however I cant figure out how to add Annotations element to it. Sample Metadata generated is as follows :-
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:sap="http://www.sap.com/Protocols/SAPData" Version="1.0">
<edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
m:DataServiceVersion="1.0">
<Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="myNamespace" sap:schema-version="1">
<EntityType Name="System">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Edm.Int32" Nullable="false" />
<Property Name="name" Type="Edm.String" sap:label="System Name" sap:creatable="false"
sap:updatable="false" sap:sortable="false" sap:required-in-filter="true"/>
<Property Name="description" Type="Edm.String" />
<Property Name="status" Type="Edm.String" />
<Property Name="type" Type="Edm.String" />
</EntityType>
<EntityContainer Name="ODataEntityContainer" m:IsDefaultEntityContainer="true">
<EntitySet Name="Systems" EntityType="myNamespace.System" />
<FunctionImport Name="NumberOfSystems" ReturnType="Collection(myNamespace.System)"
m:HttpMethod="GET" />
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
I need to add following elements to above metatada
<Annotations Target="myNamespace.System"
xmlns="http://docs.oasis-open.org/odata/ns/edm">
<Annotation Term="com.sap.vocabularies.UI.v1.LineItem">
<Collection>
<Record Type="com.sap.vocabularies.UI.v1.DataField">
<PropertyValue Property="Value" Path="name" />
</Record>
<Record Type="com.sap.vocabularies.UI.v1.DataField">
<PropertyValue Property="Value" Path="description"/>
</Record>
<Record Type="com.sap.vocabularies.UI.v1.DataField">
<PropertyValue Property="Value" Path="status" />
</Record>
</Collection>
</Annotation>
</Annotations>
I came across the org.apache.olingo.commons.api.edm.provider.annotation package but cant find any suitable API. Please let me know how should I proceed.
Thanks in advance.
The annotations you would like to use have been introduced with OData V3 which is why they are not directly supported with the Olingo V2 library.
You can use the EdmProvider AnnotationElement and AnnotationAttribute classes to mimic this behaviour though. For example You can create a AnnotationElement with the name "Annotations" this element will then have the "AnnotationAttribute" Target=SomeString. Since an "AnnotationElement" can have child elements you can put your Collection element there. Namespaces are also handled with "AnnotationAttributes".
You can only attach the annotation to Edm elements which are derived from the EdmAnnotatable interface. So this is a difference to V3.
This is currently the only way to get this behaviour with Olingo V2.
I'm using dwr and spring and I get this error:
java.lang.IllegalArgumentException: Javascript name * is used by 2 classes
I found nothing helpful on Google, do you know why I'm getting this error?
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
http://www.directwebremoting.org/schema/spring-dwr
http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd">
<dwr:configuration />
<dwr:controller id="dwrController" debug="true" />
<bean id="ping" class="com.mycompany.Ping">
<dwr:remote javascript="rpcPing">
<dwr:include method="ping" />
</dwr:remote>
</bean>
</beans>
Found.
Because the version of the DWR's jar did not match the version of DWR's schema
In my case the reason was that the relevant snippets in dwr.xml were there twice.
<create creator="new" javascript="Tab">
<param name="class" value="org.openxava.web.dwr.Tab"/>
</create>
...
<create creator="new" javascript="Tab">
<param name="class" value="org.openxava.web.dwr.Tab"/>
</create>