Free Support Forum - groupdocs.com

Prefix all table in the database to avoid conflict


#1

Hi,

I’m currently integrating annotation for java with our product and I’d like to integrate it with our database. While I could provide a different user and a different schema not to mix up data between the two systems, this would require a complex deployment for our client.

Is there an easy way to prefix all the database table to avoid any name conflict ?

Thanks,


#2
Hello ,

Thank you for using GroupDocs.Annotation for Java.

Basically you can change the prefix for all database tables. In the GroupDocs.Annotation for Java we have provided an ability to change the default entity with custom entity. To do it, you should implement IAnnotation interface and then you will be able to change the tables or classes. To be able to use user's annotations you should set callback which will handle these entities as shown on screenshot.

Also you can create custom connector to your database, for how it works please check this article.

If you will have more questions please feel free to contact us.

Best regards
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#3

The issues you have found earlier (filed as ANNOTATIONJAVA-852) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by GroupDocs Notifier.

#4

Hey,

Thanks for the quick answer. I’m trying to implement what you told me, I’ve defined a GroupDocsAnnotation class which implements IAnnotation and setup the constructor with AnnotationConstructor.setConstructor as you suggested.

Works like a charm. Now I’m trying to persist this in a database (I’m using postgres with the PostgresqlDatabaseConnector)

I’ve added a @DatabaseTable(tableName=“GroupDocs_Annotation”)
to my class and @DatabaseField to most of the fields of my custom class (and a @DatabaseField(generatedId = true) for id), but I’m stuck with:

com.groupdocs.annotation.exception.AnnotationException: com.groupdocs.annotation.exception.AnnotationException: java.lang.ClassCastException: com.j256.ormlite.dao.BaseDaoImpl$4 cannot be cast to com.groupdocs.annotation.data.dao.interfaces.IAnnotationDao
at com.groupdocs.annotation.api.a.a.initializeStorage(AbstractApi.java:219)
at com.groupdocs.annotation.handler.AnnotationHandler.(AnnotationHandler.java:43)
at com.groupdocs.annotation.handler.AnnotationHandler.(AnnotationHandler.java:31)

Any pointer to what I’m missing ?

Thanks



#5

Thanks, we manage to get this working.

Now (almost) everything is seamlessly integrated in our database without any name collision !

It looks like an sqlite database is still used to manage the mapping between “links” and “documentName” which is a real issue for us. Our documents are stored on many different CMS, we are just copying them while annotating them in a temporary directory under a temporary name (we do have our own guid for them though). Each server from our cluster is thus using its own sqlite database resulting in collision with document names and annotations moving from one document to another.

Is there a way to customize this behavior and user our guid ? I’ve looked into InputDataHandler (from 1.8.0) but it looks like nothing is working if EncodedPath is not used, and it looks like this is the function using the sqllite database. Example from 2.0.0 looks promising with GroupDocsFileDescription, but I’ve noticed the use of EncodedPath in the example you are giving, so I’m wondering if this is the right approach for this issue.



Thanks for the help,

#6
Hello,

Thank you for your request.

Could you please share with us your code example of the AnnotationConstructor and your PostgresqlDatabaseConnector. Will be useful if you share with us your project example, because we can't reproduce your issue on our side.

Please come back to us with these details and we will be glad to help you.

Best regards
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#7
Hello,

Thank you for your inquiry.

We glad to hear that with our new version of the GroupDocs.Annotation your previous issues were resolved.

About your last question - basically our "InputDataHandler" class was created with opportunity to use different GUID to identify files and you can try to use your GUIDs and then just set them to "GroupDocsFileDescription" class. The "EncodePath" class was created as an example and was needed to encode file path with its name.

If you will have more questions please feel free to contact us.

-------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#8

Hey,

Here’s what I can extract from my project:

IConnector connector = new PostgresqlDatabaseConnector(“server”,5432,"db,"db,“db”);

AnnotationConstructor.setConstructor(new IConstructor() {
@Override
public IAnnotation create() {
return new GroupDocsAnnotation();
}

@Override
public IAnnotation create(IAnnotation obj) {
return new GroupDocsAnnotation(); //FIXME
}

@Override
public Class getClazz() {
return GroupDocsAnnotation.class;
}
} );

annotationHandler = new AnnotationHandler(serviceConfiguration, connector);


The groupdocsAnnotation.java is attached




#9

Hello,

Indeed the new API is working perfectly for us thanks.

Now on to the next issue: it seems that groupdocs annotation for Java 2.0 don’t work with atmosphere disabled anymore, I get this error in the browser javascript console:

Uncaught TypeError: Cannot read property ‘annotationHub’ of undefined

I tested with the “standard” demo webapp you are providing and I get the same result as soon as I disabled atmosphere with:
disableAtmosphere=true in the application.properties

Is there anything I am missing ?

Thanks


#10
Hello,

Thank you for your details.

We have tested the scenario and have managed to reproduce the same issue at our side. We have logged this problem in our issue tracking system as ANNOTATIONJAVA-852. We have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for the inconvenience.

Best regards
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#11
Hello ,

Thank you for your inquiry.

We will investigate this issue and when we will have any news about this issue you will be notified .

Sorry for the inconvenience.

-------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#12
Hello,

We have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as ANNOTATIONJAVA-880. We have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for the inconvenience.

--------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+