Examples of WGDatabase


Examples of de.innovationgate.webgate.api.WGDatabase

  }
 
  public ActionResult callAction(RemoteSession session, String dbKey, String actionID, String executionContext, List<Object> params, Form form) throws WGAServiceException {
        try {
            // Open db
            WGDatabase db = retrieveAndOpenDB(session, dbKey);
           
            // Test permissions
            if (!mayCallAction(db, actionID)) {
                throw new WGAServiceException("You are not permitted to call remote action '" + actionID + "'");
            }
           
            // Get root content and action
            TMLContext context = new TMLContext(db.getDummyContent(db.getDefaultLanguage()), _core, null, null);
            context.makeThreadMainContext();
           
            TMLAction action = context.getActionByID(actionID, null);
            if (action == null) {
                throw new WGAServiceException("Undefined action: " + actionID);
            }
           
            // Calculate execution context
            if (executionContext != null) {
                context = context.context(executionContext, false);
                if (context == null) {
                    throw new WGAServiceException("Unretrievable execution context: " + executionContext);
                }
            }
           
            // Create TMLForm, if form information was issued
            if (form != null) {
                FormInfo formInfo = new FormInfo(form.getId(), false, false);
                formInfo.setSource("none");
                formInfo.setKeepOnValidate(false);
                CSConfig csConfig = (CSConfig) db.getAttribute(WGACore.DBATTRIB_CSCONFIG);
                if (csConfig != null) {
                    formInfo.setVersionCompliance(csConfig.getVersionCompliance());
                }
                de.innovationgate.wgpublisher.webtml.utils.TMLForm tmlForm = context.createform(formInfo);
                tmlForm.importServicesForm(form);
View Full Code Here

Examples of de.innovationgate.webgate.api.WGDatabase

        }
  }
 
    protected WGDatabase retrieveAndOpenDB(RemoteSession session, String dbkey) throws WGAServiceException {
        try {
            WGDatabase db = (WGDatabase) _core.getContentdbs().get(dbkey);
            if (db == null) {
              throw new WGAServiceException("No database of key '" + dbkey + "'");
            }
           
            // check client access to db
            if (!_core.isClientPermitted(db, getRequest())) {
                throw new WGAServiceException("Client '" + (getRequest()).getRemoteAddr() + " is not permitted to access db '" + db.getDbReference() + "'.");
            }
           
            // Normal db user login
            if (session.getDomain() != null) {
              
                DomainConfiguration domainConfig = _core.getDomainConfigForDatabase(db);
                if (!domainConfig.getName().equals(session.getDomain())) {
                    throw new WGAServiceException("The database '" + db.getDbReference() + "' is not in domain '" + session.getDomain() + "'");
                }
               
                if (_core.getBruteForceLoginBlocker().login(db, session.getUsername(), session.getPassword()) <= WGDatabase.ACCESSLEVEL_NOACCESS) {
                    throw new WGAServiceException("Login is invalid or no access to database '" + dbkey + "'");
                }
                return _core.prepareDB(db, null);   
            }
           
            // Administrative login
            else {
               
                HttpServletRequest request = getRequest();
                if (!_core.isAdministrativePort(request.getLocalPort())) {
                    throw new WGAServiceException("Administrative services are not enabled");
                }
              
                if (!_core.isAdminLogin(session.getUsername(), session.getPassword(), request)) {
                    throw new WGAServiceException("Administrative login is invalid");
                }
               
                if (!db.isSessionOpen()) {
                  db.openSession();
                }
                return _core.prepareDB(db, null);
            }
           
           
View Full Code Here

Examples of de.innovationgate.webgate.api.WGDatabase

  protected HttpServletRequest getRequest() {
    return _contextProvider.getRequest();
  }

  public int getAccessLevel(RemoteSession session, String dbKey) throws WGAServiceException {
        WGDatabase db = retrieveAndOpenDB(session, dbKey);
        if (db.isSessionOpen()) {
            return db.getSessionContext().getAccessLevel();
        }
        else {
            return WGDatabase.ACCESSLEVEL_NOACCESS;
        }
  }
View Full Code Here

Examples of de.innovationgate.webgate.api.WGDatabase

  }
 
  public void databaseUpdate(WGDatabaseEvent event) {
 
    // Verify database is open(able)
    WGDatabase db = event.getDatabase();
    WGDocumentKey docKey = event.getEditedDocumentKey();
    if (event.getType() == WGDatabaseEvent.TYPE_UPDATE &&  (docKey == null || docKey.getDocType() == WGDocument.TYPE_CONTENTTYPE)) {
      updateDatabaseEvents(db);
    }
   
View Full Code Here

Examples of de.innovationgate.webgate.api.WGDatabase

        catch (WGAPIException e) {
            _log.error("Cannot process create event for content '" + contentEvent.getDocumentKey() + "' (DB " + contentEvent.getDatabase().getDbReference() + ").", e);
            return;
        }
       
    WGDatabase db = contentEvent.getDatabase();
    if (!db.getSessionContext().isContentTypeEventsEnabled()) {
            return;
        }
   
    String dbKey = (String) db.getAttribute(WGACore.DBATTRIB_DBKEY);
   
    HttpServletRequest request = (HttpServletRequest) db.getSessionContext().getAttribute(WGACore.DBSESSIONCONTEXT_REQUEST);
    TMLUserProfile userProfile = null;
    if (request != null) {
      userProfile = (TMLUserProfile) request.getAttribute(WGACore.ATTRIB_PROFILE + db.getDbReference());
    }
   
    String contentType = contentEvent.getContentType();
        WGDocumentKey docKey = new WGDocumentKey(contentEvent.getDocumentKey());
    EventPath eventPath = createContentEventPath(EVENTNAME_CREATECONTENT, dbKey, contentType, docKey.getName());
View Full Code Here

Examples of de.innovationgate.webgate.api.WGDatabase

    public void contentStoreConnected(WGACoreEvent event) {
    }

    public void contentStoreDisconnected(WGACoreEvent event) {

        WGDatabase db = event.getDatabase();
        String dbkey = (String) db.getAttribute(WGACore.DBATTRIB_DBKEY);
        _lastDeployments.remove(dbkey);

    }
View Full Code Here

Examples of de.innovationgate.webgate.api.WGDatabase

        }
        catch (WGAPIException e) {
            _log.error("Cannot process save event for content '" + contentEvent.getDocumentKey() + "' (DB " + contentEvent.getDatabase().getDbReference() + ").", e);
            return false;
        }
    WGDatabase db = contentEvent.getDatabase();
    if (!db.getSessionContext().isContentTypeEventsEnabled()) {
        return true;
    }
   
    String dbKey = (String) db.getAttribute(WGACore.DBATTRIB_DBKEY);
   
    HttpServletRequest request = (HttpServletRequest) db.getSessionContext().getAttribute(WGACore.DBSESSIONCONTEXT_REQUEST);
    TMLUserProfile userProfile = null;
    if (request != null) {
      userProfile = (TMLUserProfile) request.getAttribute(WGACore.ATTRIB_PROFILE + db.getDbReference());
    }
   
    String contentType = contentEvent.getContentType();
        WGDocumentKey docKey = new WGDocumentKey(contentEvent.getDocumentKey());
    EventPath eventPath = createContentEventPath(EVENTNAME_SAVECONTENT, dbKey, contentType, docKey.getName());
View Full Code Here

Examples of de.innovationgate.webgate.api.WGDatabase

   * @see de.innovationgate.webgate.api.WGWorkflowEventListener#workflowMail(de.innovationgate.webgate.api.WGWorkflowEvent)
   */
  public void workflowMail(de.innovationgate.webgate.api.workflow.WGWorkflowEvent workflowEvent) {
   
    WGContent newContent = workflowEvent.getContent();
    WGDatabase db = newContent.getDatabase();
    if (!db.getSessionContext().isContentTypeEventsEnabled()) {
            return;
        }
   
    String dbKey = (String) db.getAttribute(WGACore.DBATTRIB_DBKEY);

    String contentType = "*";
    try {
            if (newContent.getStructEntry() != null && newContent.getStructEntry().getContentType() != null) {
              contentType = newContent.getStructEntry().getContentType().getName();
View Full Code Here

Examples of de.innovationgate.webgate.api.WGDatabase

    /* (non-Javadoc)
     * @see de.innovationgate.webgate.api.WGContentEventListener#contentHasBeenDeleted(de.innovationgate.webgate.api.WGContentEvent)
     */
    public void contentHasBeenDeleted(WGContentEvent contentEvent) {
       
    WGDatabase db = contentEvent.getDatabase();
    if (!db.getSessionContext().isContentTypeEventsEnabled()) {
            return;
        }
       
        WGContent content = null;
        try {
             content = contentEvent.getContent();
        }
        catch (WGAPIException e) {
            _log.error("Cannot process has been deleted event for content '" + contentEvent.getDocumentKey() + "' (DB " + contentEvent.getDatabase().getDbReference() + ").", e);
            return;
        }
       
        if (content == null) {
            try {
                content = db.getDummyContent(db.getDefaultLanguage());
            }
            catch (WGAPIException e) {
                _log.error("Cannot process deletion event for content '" + contentEvent.getDocumentKey() + "' (DB " + contentEvent.getDatabase().getDbReference() + ") because no context is available.", e);
                return;
            }
        }
       
    String dbKey = (String) db.getDbReference();
   
    HttpServletRequest request = (HttpServletRequest) db.getSessionContext().getAttribute(WGACore.DBSESSIONCONTEXT_REQUEST);
    TMLUserProfile userProfile = null;
    if (request != null) {
      userProfile = (TMLUserProfile) request.getAttribute(WGACore.ATTRIB_PROFILE + db.getDbReference());
    }
   
    String contentType = "*";
    if (contentEvent.getContentType() != null) {
      contentType = contentEvent.getContentType();
View Full Code Here

Examples of de.innovationgate.webgate.api.WGDatabase

            _log.error("Cannot process update event for content '" + contentEvent.getDocumentKey() + "' (DB " + contentEvent.getDatabase().getDbReference() + ").", e);
            return;
        }
       
       
    WGDatabase db = contentEvent.getDatabase();
    if (!db.getSessionContext().isContentTypeEventsEnabled()) {
            return;
        }
   
    String dbKey = (String) db.getAttribute(WGACore.DBATTRIB_DBKEY);
   
    HttpServletRequest request = (HttpServletRequest) db.getSessionContext().getAttribute(WGACore.DBSESSIONCONTEXT_REQUEST);
    TMLUserProfile userProfile = null;
    if (request != null) {
      userProfile = (TMLUserProfile) request.getAttribute(WGACore.ATTRIB_PROFILE + db.getDbReference());
    }
   
    String contentType = "*";
    try {
            if (newContent != null && newContent.hasCompleteRelationships()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.