use of org.wso2.carbon.core.commons.stub.loggeduserinfo.ExceptionException in project carbon-business-process by wso2.
the class AttachmentUploadClient method addUploadedFileItem.
/**
* Upload the attachment and return the attachment id
* @param fileItemData wrapper for the attachment
* @return attachment id for the uploaded attachment
* @throws AttachmentMgtException If an error occurred in the back-end component
* @throws RemoteException if an error during the communication
*/
public String addUploadedFileItem(FileItemData fileItemData) throws AttachmentMgtException, RemoteException, ExceptionException {
DataHandler handler = fileItemData.getDataHandler();
TAttachment attachment = new TAttachment();
attachment.setName(handler.getName());
attachment.setContentType(handler.getContentType());
attachment.setCreatedBy(getUserName());
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
attachment.setCreatedTime(calendar);
attachment.setContent(handler);
String attachmentID = stub.add(attachment);
log.info("Attachment was uploaded with id:" + attachmentID);
return attachmentID;
}
use of org.wso2.carbon.core.commons.stub.loggeduserinfo.ExceptionException in project carbon-apimgt by wso2.
the class APIUtil method getLoggedInUserInfo.
/**
* Gets the information of the logged in User.
*
* @param cookie Cookie of the previously logged in session.
* @param serviceUrl Url of the authentication service.
* @return LoggedUserInfo object containing details of the logged in user.
* @throws ExceptionException
* @throws RemoteException
*/
public static LoggedUserInfo getLoggedInUserInfo(String cookie, String serviceUrl) throws RemoteException, ExceptionException {
LoggedUserInfoAdminStub stub = new LoggedUserInfoAdminStub(null, serviceUrl + "LoggedUserInfoAdmin");
ServiceClient client = stub._getServiceClient();
Options options = client.getOptions();
options.setManageSession(true);
options.setProperty(HTTPConstants.COOKIE_STRING, cookie);
return stub.getUserInfo();
}
Aggregations