本文整理汇总了Java中lotus.domino.NotesException类的典型用法代码示例。如果您正苦于以下问题:Java NotesException类的具体用法?Java NotesException怎么用?Java NotesException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NotesException类属于lotus.domino包,在下文中一共展示了NotesException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteAnonymousDoc
import lotus.domino.NotesException; //导入依赖的package包/类
/**
* Delete anonymous doc.
*
* @param session the session
* @throws NotesException the notes exception
*/
//if the user moved from anonymous to person to anonymous to person
private void deleteAnonymousDoc(Session session) throws NotesException{
Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
View view = db.getView(Const.VIEW_USERS);
Vector<String> keys = new Vector<String>(3);
keys.add(this.getSessionId().trim());
keys.add(this.getSessionId().trim());
DocumentCollection col = view.getAllDocumentsByKey(keys,true);
if(col!=null && col.getCount() > 0){
col.stampAll(Const.FIELD_FORM, Const.FIELD_VALUE_DELETE);
col.recycle();
}
}
示例2: recycle
import lotus.domino.NotesException; //导入依赖的package包/类
@Override
public void recycle(Vector paramVector) throws NotesException {
if (paramVector!=null) {
for (int i=0; i<paramVector.size(); i++) {
Object obj = paramVector.get(i);
if (obj instanceof Base) {
try {
((Base)obj).recycle();
}
catch (NotesException e) {
//
}
}
}
}
}
示例3: getUserDoc
import lotus.domino.NotesException; //导入依赖的package包/类
/**
* Gets the user doc.
*
* @param session the session
* @param create the create
* @return the user doc
* @throws NotesException the notes exception
*/
private Document getUserDoc(Session session, boolean create) throws NotesException{
Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
Document doc = null;
View users = db.getView(Const.VIEW_USERS);
View sessions = db.getView(Const.VIEW_SESSIONS);
doc = users.getDocumentByKey(user.getUserId().trim(),true);
if(doc == null){
doc = sessions.getDocumentByKey(user.getSessionId(),true);
}
//if we get here... create the doc.
if(doc==null && create){
doc = db.createDocument();
}
//cleanup
users.recycle();
sessions.recycle();
return doc;
}
示例4: validate
import lotus.domino.NotesException; //导入依赖的package包/类
@Override
public void validate(FacesContext context, UIComponent ui, Object value)throws ValidatorException {
try {
Database db = ContextInfo.getUserDatabase();
if(!db.isFTIndexed()){
String errorMsg = "Application is not full text index. Please contact your administrator.";
FacesMessage message = new FacesMessage();
message.setSeverity(FacesMessage.SEVERITY_ERROR);
message.setDetail(errorMsg);
message.setSummary(errorMsg);
throw new ValidatorException(message);
}
} catch (NotesException e) {
logger.log(Level.SEVERE,null,e);
}
}
示例5: toDateTimeVec
import lotus.domino.NotesException; //导入依赖的package包/类
public Vector toDateTimeVec(Session session, List list) throws NotesException{
Vector vec = new Vector (list.size());
for(Object o: list){
Date dt = (Date) o;
DateTime dateTime = session.createDateTime(dt);
vec.add(dateTime);
}
return vec;
}
示例6: isAuthorized
import lotus.domino.NotesException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private boolean isAuthorized(String[] rolesAllowed) {
boolean b = false;
try{
Session s= XSPUtils.session();
Database db = XSPUtils.database();
if(s!=null && db!=null){
Vector<String> roles = db.queryAccessRoles(s.getEffectiveUserName());
for(String role : rolesAllowed){
if(roles.contains(role)){
b = true;
break;
}
}
}
}catch(NotesException n){
n.printStackTrace();
}
return b;
}
示例7: run
import lotus.domino.NotesException; //导入依赖的package包/类
@Override
public void run() {
Session session = SessionFactory.openTrusted();
try{
this.onServer = session.isOnServer();
this.version = session.getNotesVersion();
this.serverName = session.getServerName();
this.platform = session.getPlatform();
}catch(NotesException n){
logger.log(Level.SEVERE,null,n);
}finally{
SessionFactory.closeSession(session);
}
}
示例8: removeAll
import lotus.domino.NotesException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void removeAll(Document doc) throws NotesException{
boolean save = false;
Vector<String> attachments = doc.getParentDatabase().getParent().evaluate("@AttachmentNames", doc);
for(String attach : attachments){
EmbeddedObject eo = doc.getAttachment(attach);
if(eo!=null && eo.getType() == EmbeddedObject.EMBED_ATTACHMENT){
eo.remove();
save = true;
}//end if
}//end for
//only save if we need to.
if(save) {
doc.save();
}
}
示例9: envAsList
import lotus.domino.NotesException; //导入依赖的package包/类
/**
* Env as list.
*
* @param s the s
* @param key the key
* @param defaultValue the default value
* @return the list
* @throws NotesException the notes exception
*/
private List<String> envAsList(Session s, String key, String defaultValue) throws NotesException{
String str=this.getValue(s,key);
//if both values are empty... return an empty ArrayList.
if(StrUtils.areEmpty(str, defaultValue)){
return new ArrayList<String>();
}else if(StrUtils.isEmpty(str)){
str = defaultValue;
}
String[] arr = str.split(StringCache.COMMA);
List<String> list = new ArrayList<String>();
for(String value : arr){
list.add(value.trim());
}
return list;
}
示例10: init
import lotus.domino.NotesException; //导入依赖的package包/类
@Override
@Inject
public void init(IDominoWebSocketServer server){
if(isOn.compareAndSet(false, true)) {
this.server = server;
ApplicationEx appEx = (ApplicationEx) XSPUtils.app();
//add the listeners
appEx.addApplicationListener(new AppListener());
appEx.addSessionListener(new SocketSessionListener());
//catch the very first user.
try {
this.registerCurrentUser();
} catch (NotesException e) {
LOG.log(Level.SEVERE,null,e);
}
}
}
示例11: createUser
import lotus.domino.NotesException; //导入依赖的package包/类
@Override
public IUser createUser(Document doc) {
IUser user = guicer.createObject(IUser.class);
try {
user.setConn(null); // conn should be null, user is on a different server in the cluster.
user.setDate(doc.getCreated().toJavaDate());
user.setGoingOffline(false);
user.setHost(doc.getItemValueString(Const.FIELD_HOST));
user.setSessionId(doc.getItemValueString(Const.FIELD_SESSIONID));
user.setStatus(doc.getItemValueString(Const.FIELD_STATUS));
user.setUserId(doc.getItemValueString(Const.FIELD_USERID));
} catch (NotesException e) {
LOG.log(Level.SEVERE,null, e);
}
return user;
}
示例12: scanForAttachedJson
import lotus.domino.NotesException; //导入依赖的package包/类
/**
* Scan for attached json.
*
* @param rtitem the rtitem
* @return the string
* @throws NotesException the notes exception
*/
private String scanForAttachedJson(RichTextItem rtitem)throws NotesException{
String json = null;
@SuppressWarnings("unchecked")
Vector<EmbeddedObject> objects = rtitem.getEmbeddedObjects();
for(EmbeddedObject eo: objects){
if(eo.getName().toLowerCase().endsWith(StringCache.DOT_JSON)){
InputStream in = eo.getInputStream();
try {
json = IOUtils.toString(in,StringCache.UTF8);
int start = json.indexOf(StringCache.OPEN_CURLY_BRACE);
int end = json.lastIndexOf(StringCache.CLOSE_CURLY_BRACE);
json=json.substring(start,end) + StringCache.CLOSE_CURLY_BRACE;
} catch (IOException e) {
LOG.log(Level.SEVERE,null,e);
}finally{
IOUtils.closeQuietly(in);
eo.recycle();
eo = null;
}
}
}
return json;
}
示例13: openSessionCloner
import lotus.domino.NotesException; //导入依赖的package包/类
public static Session openSessionCloner(){
Session session = null;
try{
SessionCloner sessionCloner=SessionCloner.getSessionCloner();
NSFComponentModule module= NotesContext.getCurrent().getModule();
NotesContext context = new NotesContext( module );
NotesContext.initThread( context );
session = sessionCloner.getSession();
}catch(NotesException n){
logger.log(Level.SEVERE,null,n);
}
return session;
}
示例14: buildHostAndWebPath
import lotus.domino.NotesException; //导入依赖的package包/类
public static String buildHostAndWebPath(FacesContext context, Database db) throws NotesException{
HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
final StringBuilder url = new StringBuilder(48);
String webPath = db.getFilePath().replace("\\", "/");
String scheme = request.getScheme();
url.append(scheme);
url.append("://");
url.append(request.getServerName());
int port = request.getServerPort();
if (port > 0 &&
(("http".equalsIgnoreCase(scheme) && port != 80) ||
("https".equalsIgnoreCase(scheme) && port != 443))) {
url.append(':');
url.append(port);
}
url.append('/');
url.append(webPath);
return url.toString();
}
示例15: recycle
import lotus.domino.NotesException; //导入依赖的package包/类
@Override
public void recycle() {
try {
session.recycle();
}
catch (NotesException ignore) {}
}