Passing input to optaplanner - jboss

I'm using MySql database for Passing input to optaplanner, im creating file similar to nurserostering in optaplanner. How many tables do i need to create if i need to pass the similar data in long01.xml
Am struck on this please do give me some ideas, its my school project.
Also why is this pattern used for
<Pattern ID="0" weight="1">
<PatternEntries>
<PatternEntry index="0">
<ShiftType>L</ShiftType>
<Day>Any</Day>
</PatternEntry>
<PatternEntry index="1">
<ShiftType>D</ShiftType>
<Day>Any</Day>
</PatternEntry>
</PatternEntries>
</Pattern>

The nurse rostering example has 2 XML formats:
import dir XML: defined by the research challenge. Converted to domain objects by the mapping code in the NurseRosteringImporter
unsolved dir XML: XStream serialized of the domain objects. So no explicit mapping code needed (beyond the #XStreamAlias annotations on the domain classes).
I believe you mention the import dir XML, but the system of the unsolved XML is far more interesting because it has minimal mapping code. NurseRosteringDAO reads/writes from unsolved XML. Following the same design, you can also read/write to a database, by using Hibernate-JPA instead of XStream:
Go to hibernate.org to learn Hibernate with JPA annotations. Basically, you'll add some JPA annotations (such as #Entity and #ManyToOne) on your domain objects and use an EntityManager(Factory) to read/write those from the database.

Related

How to create a custom annotation processor for Eclipse

I'm trying to create a custom annotation processor that generates code at compilation time (as hibernate-jpamodelgen does). I've looked in the web, and I find custom annotation processors that works with maven, but do nothing when added to the Annotation Processing > Factory Path option. How could I create a processor compatible in this way? I have not found a tutorial that works.
My idea is to, for example, annotate an entity to generate automatically a base DTO, a base mapper, etc that can be extended to use in the final code.
Thank you all
OK, Already found out the problem. The tutorial I hda found out dint't specified that, in order to the compiler to be able to apply the annotation processor, there must be a META-INF/services/javax.annotation.processing.Processor file that contains the qualified class name of the processor (or processors).
I created the file pointing to my processor class, generated the jar and added it to Annotation Processing > Factory Path and all worked correctly.
Just be careful to keep the order of the processors correctly (for example, hibernate model generator claims the classes, so no more generation will be made after it), and change the jar file name each time you want to replace the library (it seems eclipse keeps a cache). These two things have given me a good headache.
Thanks all

Dozer mapping description to code

I am using Dozer to map my JAXB objects that come off a WebService interface to my domain objects. One of the elements or properties in my JAXB is a String set/setLocation(). This would be the description of the location. What I need in the backend is the to take that String and map it to a code which will be stored in my database. I've looked in the Dozer website and junit tests and I don't see anything that I can use as an example. I was hoping I could create some custom setter mapper to do this but I am looking for an example that I can start with. Any help would be appreciated.
With a little investigation I found a way to resolve my problem with a field level converter.
Here is the Dozer documentation for those interested: http://dozer.sourceforge.net/documentation/customconverter.html

Ignoring some elements/classes in JAXB binding

I use Hyperjaxb to generate some classes with JPA annotations from XML schemas. I'd like to specify which elements from given schema xjc should generate. I can't change xsd file. I can modify only bindings.xjb. I tried to use hj:ignored, but without success.
Well, hj:ignored is the answer. It allows you to make Hyperjaxb ignore certain classes.
Here's an example:
<jaxb:bindings
node="xsd:complexType[#name='issue121Type']//xsd:element[#name='simpleCollection']">
<hj:ignored/>
</jaxb:bindings>
Customizations work in schema as well as via xjb files.
See this project for instance.
How does "without success" reveal itself?

IBM Eclipse WSDL Editor: How do I include an external wsdl/schema?

I am trying to create Web Services from the Top-Down approach. I downloaded Eclipse and am using the WSDL gui editor in it to build my WSDL files.
I am splitting up my Services based on "modules". The Types I am adding to the WSDLs all need to reference common stuff, such as PersonEntity, AddressEntity, States enumeration (simple type), Countries enumeration (simple type), and AbstractEntity. Since those items are all common I created a seperate WSDL file (named Commons.wsdl) that contains the type information for those types.
I want to "import" that WSDL into my other WSDL files to use:
For example, I have an entity named RegistrationEntity which inherits from AbstractEntity and contains a PersonEntity as well as an AddressEntity. I'm not sure how to do this... I saw that the WSDL spec has "import" and "include" and am not sure which one to use. Also, how do I actually import (or include) the Commons.wsdl file so that I can use the Types defined within it?
Thanks!
Oh, and I'm not sure if I'm supposed to stick this stuff in a seperate WSDL but another type of file such as an xsd or something. I really wanna follow best practices so if that's the proper way to do it then I'd rather do that.
I found out that the problem I had was I was creating a WSDL file for my commons and using an inline scheme for that, rather than creating an XSD file to be imported by my other WSDLs.
So instead I just created an Commons.XSD as my "Common Schema".

XACML2 Schema Generation Error for .NET - Cannot use wildcards at the top level of a schema

Has anyone been able to successfully generate C# entity classes from XACML2 schema files? I am getting "Cannot use wildcards at the top level of a schema." I think this has something to do with xs:any elements. I have tried change the processContents="skip" (from "lax") but to no avail. I get this using WSCF Blue as well as xsd.exe.
Works perfectly for me using the version of xsd.exe that ships w/ VS 2010.
I have no problems running the Xacml3 schema through VS2010 XSD.exe, but I do see this "Cannot use wildcards at the top level of a schema" error when trying to process the Xacml2 schema with XSD.
XSD processes the Xacml2 Policy schema with no errors.
XSD reports this wildcard error when processing the Xacml2 Context schema.
The issue appears to be the combination of ##any and mixed="true" in the xacml-context:AttributeValueType schema definition. Other definitions of AttributeValueType in Xacml2 Policy schema and Xacml3 use an xs:complexContent wrapper around an ExpressionType extension, which in turn contains xs:any and xs:anyAttribute definitions. The Xacml2 context:AttributeValueType does not contain this wrapper.
Solution: Remove mixed="true" from the Xacml2 xacml-context:AttributeValueType definition and XSD will generate the correct class types for the schema. The generated AttributeValueType class will have properties for a list of elements and a list of attributes, which covers all the bases.