I like to creata package, POJO model asset with my java code ,using REST API.
Creating package with Apache HttpClient is fine, but I have problems creating a model asset, now I create "other assets, documentation" by putting the following
<entry xml:base="http://localhost:9080/repository/packages/package1/assets">
<title>testAsset1</title>
<summary>desc1</summary>
</entry>"
how do i make it a model asset? I tried to add a format tag but failed.
thanks
I think you can use the REST API to upload content. Send PUT request to URL something like
http://{server}/guvnor/rest/packages/{package name}/assets/{asset name}/source
Where asset name is the name of model assets. Not sure about what the mime type should be, a quick google search gave 'application/java-archive'
See the Guvnor REST API docs for more information.
You need to add below code to createAssetFromBinary method in PackageResource.java
ContentHandler handler = ContentManager.getHandler( ai.getFormat() );
if ( handler instanceof ICanHasAttachment ) {
((ICanHasAttachment) handler).onAttachmentAdded( ai );
}
You can also explore using standalone editor to create model & facts which will be stored directly in guvnor repository.
Related
I try to create the entity like this:
DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
Entity stock = new Entity("Stock", 1);
stock.setProperty("Stock", "FCB");
ds.put(stock);
but keep getting the error:
No source code is available for type com.google.appengine.api.datastore.DatastoreService; did you forget to inherit a required module?
The error means just what it says, the GWT compiler needs access to the Java source it compiles to Javascript, and obviously DatastoreService is not something that should exist on the frontend - so you have an architecture issue here.
You'll need to write a proxy that can call a server component (Which in turns calls the DatastoreService) and returns DTOs/value objects (that you define and thus have the source for).
Cheers,
No source code is available
GWT transliterate Java to Javascript, reading it's source code and there a limited language support.
What you're trying to achieve is a Server only operation and you're adding this operation within the client code, which will run on a browser. Neither GAE allow this or GWT has the source of these classes nor capability to do so.
Solution
You need to create a request to your server that will access the DatastoreService , the return the output to the client code.
Below a example of a properly architect GWT web application:
Like Rails is there any way to add custom error message to validator?
Like:
if(this.password != this.passwordConfirmation){
this.errors.add('password', {rule: 'invalid'})
}
You can create custom validations on your models. Or create custom objects and inject them into your models to resusable code. Its actually in the docs!
http://sailsjs.org/#/documentation/concepts/ORM/Validations.html?q=custom-validation-rules
You can create a custom config file for error handling. You can reach that global config object by sails.config.error for example. Advantage of this solution is, that you can access this object in services and other places, where you have no access to the res object.
Next step would be creating a policy which would pass this config error object to res.locals. Or it could be handled in a response file, but I have no experience with that.
Out of the box, Sails.js does not support custom validation messages. But there's a workaround, using hooks.
http://sailsjs.org/documentation/concepts/models-and-orm/validations#?custom-validation-rules
Says the official site.
Can someone help me out how I would go on about create documents to repository using soap createDocument.
I have a custom content model and and when I add a new document does not have the properties of the content model.
<ns:properties> <ns1:propertyId
propertyDefinitionId="cmis:objectTypeId">
<ns1:value>cmis:document</ns1:value>
<ns1:value>cms:customModel</ns1:value> </ns:properties>
Also I am looking to upload multiple attachments at time but right now I can't
<ns:contentStream>
<ns:mimeType>application/octet-stream</ns:mimeType>
<!-- Optional:-->
<ns:filename></ns:filename>
<ns:stream><xsl:copy-of select="//someelement"></xsl:copy-of></ns:stream>
</ns:contentStream>
any help on how I can get this working is greatly appreciated.
You should use OpenCMIS or a similar CMIS library instead of writing to the WS binding directly.
You appear to be attempting to set two values for cmis:objectTypeId. If you are trying to create an instance of cms:customModel, that should be the only value.
You aren't setting any custom property values in the snippets you provided.
To my knowledge, there is nothing in the spec allows you to provide multiple attachments simultaneously. You should get a single upload working first.
I want to create a alfresco site using open cmis extension. I researched and found an object type 'F:st:sites' and its properties like 'st:siteVisibility' and 'st:sitePreset'. But I am not very sure that using this we can create a site in alfresco and I am not able to find any method for creating a site. It could be something like
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.NAME, "mySiteName");
properties.put(PropertyIds.OBJECT_TYPE_ID, "F:st:sites");
properties.put("cmis:path", "/Sites");
.
.
properties.put("cmis:createdBy", date);
properties.put("st:siteVisibility", ScriptSiteService.PUBLIC_SITE);
// TODO: add method for creating site with session object
Please reply as soon as possible.
Also, if there is any other way to create a site other than apache's Http api, Please share.
Thanks,
Smita
as long as you don't post your use case, yourfull code & explain in in detail what tools you're using (Apache Chemistry/opencmis? apache's Http api?) you won't get the answer you like to get...
A Site is sth. like a extended folder & there will be an opportunity to create such a folder by using st:site type & adding the relevant properties, BUT:
afaik you won't be able to use this site via Alfresco Share because all SURF objects are not created if you create a site directly in the repo layer (explained here (but a little bit outdated if you use Alfresco 4): http://ecmstuff.blogspot.de/2011/02/creating-alfresco-share-sites-with.html).
I am developing an app using Grails and GWT for a client side.
I want to use the same date format both on the client side and on the server side (preferably defined in one file).
So far i've understood that Grails got it's own mechanism for internationalization (grails-app/i18n). I know i can access these messages from any server code using app context.
I can also access any resource file inside web-app directory.
For the client side, i can use ConstantsWithLookup interface and GWT.Create(...) to get an instance of it.
But, i still haven't found good solution to integrate these two together, so i have date format defined in one place. Any ideas or tips?
Thanks,
Sergey
After digging into Grails more, i came to a solution.
I've put constant into .properties file under grails-app/i18n.
Then, i hook to eventCompileEnd and i copy resources from grails-app/i18n to specific package in target\generated-sources.
After this step is completed, i generate google I18N interfaces using copied property files.
I've put this functionality to separate plugin.
_Events.groovy:
includeTargets << new File("${myPluginDir}/scripts/_MyInternal.groovy")
eventCompileEnd = {
internalCopyMessageResources();
}
eventCopyMessageResourcesEnd = {
generateI18NInterface();
}
Now it is possible to access localized data from server side and from client side.