I am Working on the Xamarin.MAc Project. In my project I need to Use Objective C Code so I going to bind and use in my Xamarin project.
I am using Objective sharpie for generating the Interface and enum file. that's working fine but i am not able to generate the .dll file.
This is my .cs files,
using System;
using System.Drawing;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
using System.Collections.Generic;
namespace BLVirtualDrive {
// #interface BaseItemModel : NSObject
[BaseType (typeof (NSObject))]
interface BaseItemModel {
// #property (nonatomic, strong) NSString * name;
[Export ("name", ArgumentSemantic.Retain)]
string Name { get; set; }
// #property unsigned long long id;
[Export ("id")]
ulong Id { get; set; }
// #property unsigned long long parentId;
[Export ("parentId")]
ulong ParentId { get; set; }
}
// #interface FileModel : BaseItemModel
[BaseType (typeof (BaseItemModel))]
interface FileModel {
// #property unsigned long long currentBufferSize;
[Export ("currentBufferSize")]
ulong CurrentBufferSize { get; set; }
// #property unsigned long long totalFileSize;
[Export ("totalFileSize")]
ulong TotalFileSize { get; set; }
// #property unsigned long long startByte;
[Export ("startByte")]
ulong StartByte { get; set; }
// #property unsigned long long endByte;
[Export ("endByte")]
ulong EndByte { get; set; }
// #property (nonatomic, strong) NSData * data;
[Export ("data", ArgumentSemantic.Assign)]
NSData Data { get; set; }
}
// #interface FolderModel : BaseItemModel
[BaseType (typeof (BaseItemModel))]
interface FolderModel {
}
// #interface ContentItemModel : NSObject
[BaseType (typeof (NSObject))]
interface ContentItemModel {
// #property (nonatomic, strong) NSString * itemName;
[Export ("itemName", ArgumentSemantic.Retain)]
string ItemName { get; set; }
// #property unsigned long long itemId;
[Export ("itemId")]
ulong ItemId { get; set; }
// #property unsigned long long currentBufferSize;
[Export ("currentBufferSize")]
ulong CurrentBufferSize { get; set; }
// #property unsigned long long totalItemSize;
[Export ("totalItemSize")]
ulong TotalItemSize { get; set; }
// #property enum ItemType itemType;
[Export ("itemType")]
ItemType ItemType { get; set; }
// #property unsigned long long startByte;
[Export ("startByte")]
ulong StartByte { get; set; }
// #property unsigned long long endByte;
[Export ("endByte")]
ulong EndByte { get; set; }
// #property (nonatomic, strong) NSData * data;
[Export ("data", ArgumentSemantic.Retain)]
NSData Data { get; set; }
}
// #protocol IVirtualDriveOperations <NSObject>
[Protocol, Model]
[BaseType (typeof (NSObject))]
interface IVirtualDriveOperations{
// #required -(void)mountVirtualDriveWithItems:(NSArray *)items;
[Export ("mountVirtualDriveWithItems:")]
[Abstract]
void MountVirtualDriveWithItems (NSObject [] items);
// #required -(void)unMountVirtualDrive;
[Export ("unMountVirtualDrive")]
[Abstract]
void UnMountVirtualDrive ();
// #required -(id<IVirtualDriveOperations>)getVirtualDriveobject;
[Export ("getVirtualDriveobject")]
[Abstract]
IVirtualDriveOperations GetVirtualDriveobject ();
// #required -(void)createFile:(FileModel *)fileModel;
[Export ("createFile:")]
[Abstract]
void CreateFile (FileModel fileModel);
// #required -(void)renameFile:(FileModel *)fileModel;
[Export ("renameFile:")]
[Abstract]
void RenameFile (FileModel fileModel);
// #required -(void)moveFile:(FileModel *)fileModel;
[Export ("moveFile:")]
[Abstract]
void MoveFile (FileModel fileModel);
// #required -(void)deleteFile:(FileModel *)fileModel;
[Export ("deleteFile:")]
[Abstract]
void DeleteFile (FileModel fileModel);
// #required -(void)downloadedFile:(FileModel *)fileModel;
[Export ("downloadedFile:")]
[Abstract]
void DownloadedFile (FileModel fileModel);
// #required -(void)changeFileContents:(FileModel *)fileModel;
[Export ("changeFileContents:")]
[Abstract]
void ChangeFileContents (FileModel fileModel);
// #required -(void)createFolder:(FolderModel *)folderModel;
[Export ("createFolder:")]
[Abstract]
void CreateFolder (FolderModel folderModel);
// #required -(void)renameFolder:(FileModel *)folderModel;
[Export ("renameFolder:")]
[Abstract]
void RenameFolder (FileModel folderModel);
// #required -(void)moveFolder:(FileModel *)folderModel;
[Export ("moveFolder:")]
[Abstract]
void MoveFolder (FileModel folderModel);
// #required -(void)deleteFolder:(FileModel *)folderModel;
[Export ("deleteFolder:")]
[Abstract]
void DeleteFolder (FileModel folderModel);
}
}
I am tried the Command line tool like that /Library/Frameworks/Xamarin.Mac.framework/Versions/1.10.0.18/bin/bmac -oBLVirtualDrive.dll --tmpdir=/tmp -baselib=/Library/Frameworks/Xamarin.Mac.framework/Versions/1.10.0.18/lib/mono/XamMac.dll -r=System.Drawing IBLVirtualDrive.cs -s=IBLVirtualDriveenums.cs --compiler=mcs --new-style i am getting error like this error BI1018: bmac: No [Export] attribute on property BLVirtualDrive.BaseItemModel.Name any thing i missed in the command line field.
Maybe you need try adding Xamarin.Mac.dll instead of XamMac.dll, and removing MonoMac from your source.
using Foundation;
using AppKit;
using ObjCRuntime;
Also, add the following code at the top of Extras.cs file:
using System;
[AttributeUsage (AttributeTargets.Method)]
public sealed class MonoPInvokeCallbackAttribute : Attribute {
public MonoPInvokeCallbackAttribute (Type t) {}
}
You can find more information at the next link https://forums.xamarin.com/discussion/1171/difference-between-bmac-exe-on-xamarin-and-monomac-when-compiling-masshortcutsharp
Related
I have an existing enterprise deployed application that uses OpenID Connect for authentication. Once authenticated, I store the AuthState object in the iOS keychain for security and to be able to sign the user in later with just Face/Touch ID (given the refresh token in AuthState is still valid). The AuthState object looks like this:
namespace OpenId.AppAuth
{
[Register ("OIDAuthState", true)]
public class AuthState : NSObject, INSCoding, INativeObject, IDisposable, INSSecureCoding
{
[CompilerGenerated]
private static readonly IntPtr class_ptr = Class.GetHandle ("OIDAuthState");
[CompilerGenerated]
private object __mt_ErrorDelegate_var;
[CompilerGenerated]
private object __mt_StateChangeDelegate_var;
public override IntPtr ClassHandle {
get;
}
[CompilerGenerated]
public virtual NSError AuthorizationError {
[Export ("authorizationError")]
get;
}
[CompilerGenerated]
public virtual IAuthStateErrorDelegate ErrorDelegate {
[Export ("errorDelegate", ArgumentSemantic.Weak)]
get;
[Export ("setErrorDelegate:", ArgumentSemantic.Weak)]
set;
}
[CompilerGenerated]
public virtual bool IsAuthorized {
[Export ("isAuthorized")]
get;
}
[CompilerGenerated]
public virtual AuthorizationResponse LastAuthorizationResponse {
[Export ("lastAuthorizationResponse")]
get;
}
[CompilerGenerated]
public virtual RegistrationResponse LastRegistrationResponse {
[Export ("lastRegistrationResponse")]
get;
}
[CompilerGenerated]
public virtual TokenResponse LastTokenResponse {
[Export ("lastTokenResponse")]
get;
}
[CompilerGenerated]
public virtual string RefreshToken {
[Export ("refreshToken")]
get;
}
[CompilerGenerated]
public virtual string Scope {
[Export ("scope")]
get;
}
[CompilerGenerated]
public virtual IAuthStateChangeDelegate StateChangeDelegate {
[Export ("stateChangeDelegate", ArgumentSemantic.Weak)]
get;
[Export ("setStateChangeDelegate:", ArgumentSemantic.Weak)]
set;
}
public static IAuthorizationFlowSession PresentAuthorizationRequest (AuthorizationRequest authorizationRequest, UIViewController presentingViewController, AuthStateAuthorizationCallback callback);
[CompilerGenerated]
[DesignatedInitializer]
[EditorBrowsable (EditorBrowsableState.Advanced)]
[Export ("initWithCoder:")]
public AuthState (NSCoder coder)
: base (NSObjectFlag.Empty);
[CompilerGenerated]
[EditorBrowsable (EditorBrowsableState.Advanced)]
protected AuthState (NSObjectFlag t)
: base (t);
[CompilerGenerated]
[EditorBrowsable (EditorBrowsableState.Advanced)]
protected internal AuthState (IntPtr handle)
: base (handle);
[Export ("initWithAuthorizationResponse:")]
[CompilerGenerated]
public AuthState (AuthorizationResponse authorizationResponse)
: base (NSObjectFlag.Empty);
[Export ("initWithAuthorizationResponse:tokenResponse:")]
[CompilerGenerated]
public AuthState (AuthorizationResponse authorizationResponse, TokenResponse tokenResponse)
: base (NSObjectFlag.Empty);
[Export ("initWithRegistrationResponse:")]
[CompilerGenerated]
public AuthState (RegistrationResponse registrationResponse)
: base (NSObjectFlag.Empty);
[Export ("initWithAuthorizationResponse:tokenResponse:registrationResponse:")]
[DesignatedInitializer]
[CompilerGenerated]
public AuthState (AuthorizationResponse authorizationResponse, TokenResponse tokenResponse, RegistrationResponse registrationResponse)
: base (NSObjectFlag.Empty);
[Export ("encodeWithCoder:")]
[CompilerGenerated]
[Preserve (Conditional = true)]
public virtual void EncodeTo (NSCoder encoder);
[Export ("performActionWithFreshTokens:")]
[CompilerGenerated]
public unsafe virtual void PerformWithFreshTokens ([BlockProxy (typeof(ObjCRuntime.Trampolines.NIDAuthStateAction))] AuthStateAction action);
[Export ("performActionWithFreshTokens:additionalRefreshParameters:")]
[CompilerGenerated]
public unsafe virtual void PerformWithFreshTokens ([BlockProxy (typeof(ObjCRuntime.Trampolines.NIDAuthStateAction))] AuthStateAction action, NSDictionary<NSString, NSString> additionalParameters);
[Export ("authStateByPresentingAuthorizationRequest:UICoordinator:callback:")]
[CompilerGenerated]
public unsafe static IAuthorizationFlowSession PresentAuthorizationRequest (AuthorizationRequest authorizationRequest, IAuthorizationUICoordinator UICoordinator, [BlockProxy (typeof(ObjCRuntime.Trampolines.NIDAuthStateAuthorizationCallback))] AuthStateAuthorizationCallback callback);
[Export ("setNeedsTokenRefresh")]
[CompilerGenerated]
public virtual void SetNeedsTokenRefresh ();
[Export ("tokenRefreshRequest")]
[CompilerGenerated]
public virtual TokenRequest TokenRefreshRequest ();
[Export ("tokenRefreshRequestWithAdditionalParameters:")]
[CompilerGenerated]
public virtual TokenRequest TokenRefreshRequest (NSDictionary<NSString, NSString> additionalParameters);
[Export ("updateWithAuthorizationResponse:error:")]
[CompilerGenerated]
public virtual void Update (AuthorizationResponse authorizationResponse, NSError error);
[Export ("updateWithTokenResponse:error:")]
[CompilerGenerated]
public virtual void Update (TokenResponse tokenResponse, NSError error);
[Export ("updateWithAuthorizationError:")]
[CompilerGenerated]
public virtual void Update (NSError authorizationError);
[Export ("updateWithRegistrationResponse:")]
[CompilerGenerated]
public virtual void UpdateWithRegistrationResponse (RegistrationResponse registrationResponse);
[CompilerGenerated]
protected override void Dispose (bool disposing);
}
}
Prior to iOS 12.1 update everything worked perfectly fine
PROBLEM: after installing the ios 12.1 update, only when running in release mode (works when debugging in develop mode while connected to VS for Mac debugger) querying for an existing key in the keychain storing binary NSData representation of this AuthState object hangs and eventually the application is terminated for being un-responsive for longer than 10 seconds.
Has anyone run into any similar issues? Would be amazing if anyone could shed any light on what might be going on here or point me in the right direction.
Additional information:
How I get NSData binary representation of AppAuth object:
NSData authStateData = NSKeyedArchiver.ArchivedDataWithRootObject(authState);
How I save this NSData into keychain:
var secAccess = new SecAccessControl(SecAccessible.WhenUnlockedThisDeviceOnly, SecAccessControlCreateFlags.UserPresence);
var secRecord = new SecRecord(SecKind.GenericPassword)
{
Account = "keystring",
Service = "ServiceNameString",
Label = "keystring",
ValueData = authStateData,
AccessControl = secAccess
};
var result = SecKeyChain.Add(secRecord);
How I query for existing data in keychain:
var searchRecord = new SecRecord(SecKind.GenericPassword)
{
Service = ServiceName,
Label = key,
};
var match = SecKeyChain.QueryAsRecord(searchRecord, out SecStatusCode resultCode);
There are no obvious errors in the device log, I checked. Was there a change in iOS 12.1 that I missed that significantly affects this?
UPDATE: I refactored the code to only store an encryption key password in the keychain instead of an entire AuthState object and store the serialized AuthState encrypted into a local file instead. Still seeing the same issue, in debug mode on a device everything works, writes and reads from keychain just fine, when running without debugger attached on the same device, same build, writes fine, when reading hangs after validating TouchID/FaceID successfully, is there a bug in the Xamarin.iOS SDK that hasn't caught up to some change in the latest iOS that's causing this?
You should enabling keychain sharing entitlement .
in Entitlements.plist
And here is a similar case you can refer .
I've fixed the problem i was having, it seems to have been some kind of race condition that was locking the app as the call to save into keychain was being done on the main thread. Normally this call is very quick and never had a problem locking anything up in the past, but something in the iOS 12.1 update changed that. In any case, I simply explicitly ran code saving the encryption password into keychain in a background thread and that fixed the problem:
Task.Run(() =>
{
var keychain = new KeyChain();
keychain.SetValueForKey("securedvalue", "securedvaluekey");
}).ConfigureAwait(false);
I have tried to follow this documentation in the most precise way I could:
https://beam.apache.org/documentation/sdks/javadoc/2.0.0/org/apache/beam/sdk/io/xml/XmlIO.html
Please find below my codes :
public static void main(String args[])
{
DataflowPipelineOptions options=PipelineOptionsFactory.as(DataflowPipelineOptions.class);
options.setTempLocation("gs://balajee_test/stagging");
options.setProject("test-1-130106");
Pipeline p=Pipeline.create(options);
PCollection<XMLFormatter> record= p.apply(XmlIO.<XMLFormatter>read()
.from("gs://balajee_test/sample_3.xml")
.withRootElement("book")
.withRecordElement("author")
.withRecordElement("title")
.withRecordElement("genre")
.withRecordElement("price")
.withRecordElement("description")
.withRecordClass(XMLFormatter.class)
);
record.apply(ParDo.of(new DoFn<XMLFormatter,String>(){
#ProcessElement
public void processElement(ProcessContext c)
{
System.out.println(c.element().getAuthor());
}
}));
p.run();
}
I'm getting 'null' value for every XML component. Could you please review my code and suggest me the corrective course of action required?
package com.bitwise.cloud;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
#XmlRootElement(name = "book")
#XmlType(propOrder = {"author", "title","genre","price","description"})
public class XMLFormatter {
private String author;
private String title;
private String genre;
private String price;
private String description;
public XMLFormatter() { }
public XMLFormatter(String author, String title,String genre,String price,String description) {
this.author = author;
this.title = title;
this.genre = genre;
this.price = price;
this.description = description;
}
#XmlElement
public void setAuthor(String author) {
this.author = author;
}
public String getAuthor() {
return author;
}
#XmlElement
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
#XmlElement
public void setGenre(String genre) {
this.genre = genre;
}
public String getGenre() {
return genre;
}
#XmlElement
public void setPrice(String price) {
this.price = price;
}
public String getPrice() {
return price;
}
#XmlElement
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
}
XmlIO.Read PTransform doesn't support providing multiple record elements (author, title, genre, etc). You have to provide a single root element and a record element and your XML document has to contain records that have the same record element. See the example given in the following location.
https://github.com/apache/beam/blob/master/sdks/java/io/xml/src/main/java/org/apache/beam/sdk/io/xml/XmlIO.java#L59
Following is the model with A(UserN) and B(UserRoleN) as objects.
#NodeEntity()
public class UserN
{
#GraphId
private Long id;
#Relationship(type = "hasRole", direction = Relationship.OUTGOING)
private List<UserRoleN> role;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setRole(List<UserRoleN> role) {
this.role = role;
}
public List<UserRoleN> getRole() {
return role;
}
}
#NodeEntity()
public class UserRoleN
{
#GraphId
private Long id;
private String name;
public Long getName() {
return version;
}
public void setName(String name) {
this.name = name;
}
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
}
In the database, following is graph structure:
A->B
While loading A, session.load(A.class, id, 1) , a total of 2 B-Objects are loading under A Object in which one of the B's ID is null and other B object ID is neo4j generated.
Unable to understand why the duplicate B is loaded where Database has only one B Object.
Would like to know how to hide a model property in Swagger on POST. I have tried both Swagger-springmvc (0.9.3) and Springfox (supports swagger spec 2.0) to no avail.
Problem being I would like to see this in the GET requests through Swagger. But not POST requests, since id is auto-assigned, I would like to hide it just for the POST request.
public class RestModel {
private int id;
#JsonProperty
private String name;
#JsonProperty
public int getId() {
return 0;
}
#JsonIgnore
public void setId(int customerId) {
this.customerId = customerId;
}
public int getName() {
return "abc";
}
public void setName(String name) {
this.name = name;
}
}
So on GET, I should see:
{
"id": 0,
"name" : "abc"
}
And on POST, I should see just:
{
"name"
}
Tried adding: #ApiModelProperty(readonly=true). But that didn't help.
I have solved this with simply extending the Object that I want to hide a property of when using as request parameter.
Example:
I have the object Person.java:
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
import org.joda.time.DateTime;
import org.joda.time.Years;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import io.swagger.annotations.ApiModelProperty;
/**
* Simple Person pojo
*/
#Entity
public class Person {
#GeneratedValue(strategy = GenerationType.AUTO)
#Id
private Long dbId;
private String name;
private Long id;
#JsonFormat(pattern="yyyy-MM-dd")
private Date birthDate;
private String gender;
public Person() {
}
public Person(long dbId) {
this.dbId = dbId;
}
public Person(Long id, String name, Date birthDate, String gender) {
this.id = id;
this.name = name;
this.birthDate = birthDate;
this.gender = gender;
}
public Long getDbId() {
return dbId;
}
public String getName() {
return name;
}
public Date getBirthDate() {
return birthDate;
}
public String getGender() {
return gender;
}
public Integer getAge() {
return Years.yearsBetween(new DateTime(birthDate), new DateTime()).getYears();
}
public void setDbId(Long dbId) {
this.dbId = dbId;
}
public void setName(String name) {
this.name = name;
}
public void setBirthDate(Date birthDate) {
this.birthDate = birthDate;
}
public void setGender(String gender) {
this.gender = gender;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
I have simply created another class: PersonRequest.java:
import com.fasterxml.jackson.annotation.JsonIgnore;
public class PersonRequest extends Person {
#Override
#JsonIgnore
public void setDbId(Long dbId) {
super.setDbId(dbId);
}
}
RequestMapping looks simply like:
#RequestMapping(value = "/KVFirstCare/application", method = RequestMethod.POST)
public ApplicationResult application(#RequestBody List<PersonRequest> persons,
HttpServletResponse response) {
}
Works like charm :)
Unfortunately having different request and response models is not supported currently in springfox. The current thought is that we might support this feature using #JsonView in the future.
The problem is since my POJO/Domain classes are in java (obvious actually but just to make it clear) the sub-object that i use does'nt show up properly in the form when I click on available controllers: Eg: Patient has address -->> address is a sub-object in patient:
The address field shows a blank dropdown. How do i resolve this?
I am using def scaffold= in the controller.
package pojo;
public class Address {
private int id;
private String street;
private String city;
private String state;
private String country;
private Integer clinicid;
private Integer patientid;
public Address(){
super();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public Integer getClinicid() {
return clinicid;
}
public void setClinicid(Integer clinicid) {
this.clinicid = clinicid;
}
public Integer getPatientid() {
return patientid;
}
public void setPatientid(Integer patientid) {
this.patientid = patientid;
}
}
package pojo;
public class Clinic {
private int id ;
private String clinicname ;
private Address address;
public int contactNumber;
public Clinic() {
address=new Address();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getClinicname() {
return clinicname;
}
public void setClinicname(String clinicname) {
this.clinicname = clinicname;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
address.setClinicid(this.id);
this.address = address;
}
public int getContactNumber() {
return contactNumber;
}
public void setContactNumber(int contactNumber) {
this.contactNumber = contactNumber;
} }
package pojo;
import java.util.*;
public class Doctor {
private int id ;
private Date dateOfBirth ;
private String username;
private String password ;
//private String name ;
private int contactNumber ;
private String specialization ;
public Clinic clinic;
public Doctor(){
clinic=new Clinic();
}
public Clinic getClinic() {
return clinic;
}
public void setClinic(Clinic clinic) {
this.clinic = clinic;
}
/*public Doctor() {
}*/
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Date getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getContactNumber() {
return contactNumber;
}
public void setContactNumber(int contactNumber) {
this.contactNumber = contactNumber;
}
public String getSpecialization() {
return specialization;
}
public void setSpecialization(String specialization) {
this.specialization = specialization;
}
}
package pojo;
import java.util.*;
public class Patient {
private int id;
private Date dateOfBirth;
private Date registrationDate;
private String name ;
public int contactNumber;
public enum sexenum {MALE, FEMALE}
public sexenum sex;
private Address address;
private Clinic clinic;
private Doctor doctor;
public Patient(){
clinic=new Clinic();
doctor=new Doctor();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Date getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
public Date getRegistrationDate() {
return registrationDate;
}
public void setRegistrationDate(Date registrationDate) {
this.registrationDate = registrationDate;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getContactNumber() {
return contactNumber;
}
public void setContactNumber(int contactNumber) {
this.contactNumber = contactNumber;
}
public sexenum getSex() {
return sex;
}
public void setSex(sexenum sex) {
this.sex = sex;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
address.setPatientid(this.id);
this.address = address;
}
public Clinic getClinic() {
return clinic;
}
public void setClinic(Clinic clinic) {
this.clinic = clinic;
}
public Doctor getDoctor() {
return doctor;
}
public void setDoctor(Doctor doctor) {
this.doctor = doctor;
}
}
patient [ one to one with ] address;.
clinic [ one to one with ] address;.
doctorid [ foreign key many to one]where ever referenced.
clinic id [foreign key many to one ] where ever referenced.
As far as I know, Grails only supports GORM-mappings (http://grails.org/doc/latest/guide/single.html#ormdsl) and hibernate mappings (http://grails.org/doc/latest/guide/single.html#hibernate)
I don't think the mappings you provide are valid for scaffolding.