Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
12 replies
Subscribers
7 subscribers
Views
5012 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Integrations
Hi Guys, is there a way to call an Appian function within my Java Code (Smart Se
Jess
over 9 years ago
Hi Guys, is there a way to call an Appian function within my Java Code (Smart Service Plugin)? I need to use todocument() function to convert the input string (ex. "[DocumentId: xxxx]" ) to a document.
Also, once I got the document, I need to get the server path/filename of that file.
Thanks in advance!
OriginalPostID-192788
OriginalPostID-192788
Discussion posts and replies are publicly visible
Parents
0
Rahul Gundu
over 9 years ago
Hi jessicae, ContentService can be be used out side of the constructor also. In previous, i have used in constructor, but it can work out side the constructor also. Before using the ContentService, in code we need made some configurtion as per documentation in API.
Sample Code i used before:
/* Under Construction */
public TwitterIntegration(SmartServiceContext smartServiceCtx) {
/* Step1 */ this.smartServiceCtx = smartServiceCtx;
/* Step2 */ this.serviceContext = ServiceLocator.getAdministratorServiceContext();
/* Step3 */ this.contentService = ServiceLocator.getContentService((ServiceContext)this.serviceContext);
}
I think you missed Step2 in your code. Because of that you are getting null.
Code Sample mentioned in API
Code example (using ServiceLocator and ServiceContext):
ServiceContext sc = ServiceLocator.getAdministratorServiceContext();
ContentService cs = ServiceLocator.getContentService(sc);
Long rulesRootId = cs.getIdByUuid(ContentConstants.UUID_RULES_ROOT_FOLDER);
If you want more information you can find in API in respected Interface "ContentService".
Sample Code
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Rahul Gundu
over 9 years ago
Hi jessicae, ContentService can be be used out side of the constructor also. In previous, i have used in constructor, but it can work out side the constructor also. Before using the ContentService, in code we need made some configurtion as per documentation in API.
Sample Code i used before:
/* Under Construction */
public TwitterIntegration(SmartServiceContext smartServiceCtx) {
/* Step1 */ this.smartServiceCtx = smartServiceCtx;
/* Step2 */ this.serviceContext = ServiceLocator.getAdministratorServiceContext();
/* Step3 */ this.contentService = ServiceLocator.getContentService((ServiceContext)this.serviceContext);
}
I think you missed Step2 in your code. Because of that you are getting null.
Code Sample mentioned in API
Code example (using ServiceLocator and ServiceContext):
ServiceContext sc = ServiceLocator.getAdministratorServiceContext();
ContentService cs = ServiceLocator.getContentService(sc);
Long rulesRootId = cs.getIdByUuid(ContentConstants.UUID_RULES_ROOT_FOLDER);
If you want more information you can find in API in respected Interface "ContentService".
Sample Code
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data