/** This command is used to get the navigationtitle for a sitenode in a certain language. */ public String doGetPageNavigationTitle() throws Exception { DatabaseWrapper dbWrapper = new DatabaseWrapper(CastorDatabaseService.getDatabase()); // Database db = CastorDatabaseService.getDatabase(); beginTransaction(dbWrapper.getDatabase()); try { Principal principal = (Principal) this.getHttpSession().getAttribute("infogluePrincipal"); if (principal == null) { try { Map arguments = new HashMap(); arguments.put("j_username", CmsPropertyHandler.getAnonymousUser()); arguments.put("j_password", CmsPropertyHandler.getAnonymousPassword()); principal = ExtranetController.getController().getAuthenticatedPrincipal(arguments); } catch (Exception e) { throw new SystemException( "There was no anonymous user found in the system. There must be - add the user anonymous/anonymous and try again.", e); } } this.nodeDeliveryController = NodeDeliveryController.getNodeDeliveryController( getSiteNodeId(), getLanguageId(), getContentId()); this.integrationDeliveryController = IntegrationDeliveryController.getIntegrationDeliveryController( getSiteNodeId(), getLanguageId(), getContentId()); TemplateController templateController = getTemplateController( dbWrapper, getSiteNodeId(), getLanguageId(), getContentId(), getRequest(), (InfoGluePrincipal) principal, false); this.navigationTitle = templateController.getPageNavTitle(this.getSiteNodeId()); closeTransaction(dbWrapper.getDatabase()); } catch (Exception e) { logger.error("An error occurred so we should not complete the transaction:" + e, e); rollbackTransaction(dbWrapper.getDatabase()); throw new SystemException(e.getMessage()); } return "navigationTitle"; }
public String doExecute() throws Exception { try { CreateSiteNodeWizardInfoBean createSiteNodeWizardInfoBean = getCreateSiteNodeWizardInfoBean(); if (createSiteNodeWizardInfoBean.getParentSiteNodeId() == null) { return "stateLocation"; } createSiteNodeWizardInfoBean .getSiteNodeVO() .setCreatorName(this.getInfoGluePrincipal().getName()); this.ceb = createSiteNodeWizardInfoBean.getSiteNodeVO().validate(); if (!this.ceb.isEmpty()) { return "inputSiteNode"; } Integer repositoryId = createSiteNodeWizardInfoBean.getRepositoryId(); SiteNodeVO newSiteNodeVO = null; Database db = CastorDatabaseService.getDatabase(); ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer(); beginTransaction(db); try { createSiteNodeWizardInfoBean.getSiteNodeVO().setIsBranch(new Boolean(true)); SiteNode newSiteNode = SiteNodeControllerProxy.getSiteNodeControllerProxy() .acCreate( this.getInfoGluePrincipal(), createSiteNodeWizardInfoBean.getParentSiteNodeId(), createSiteNodeWizardInfoBean.getSiteNodeTypeDefinitionId(), repositoryId, createSiteNodeWizardInfoBean.getSiteNodeVO(), db); newSiteNodeVO = newSiteNode.getValueObject(); SiteNodeController.getController() .createSiteNodeMetaInfoContent( db, newSiteNodeVO, repositoryId, this.getInfoGluePrincipal(), createSiteNodeWizardInfoBean.getPageTemplateContentId(), new ArrayList()); commitTransaction(db); } catch (Exception e) { logger.error("An error occurred so we should not completes the transaction:" + e, e); rollbackTransaction(db); throw new SystemException(e.getMessage()); } String returnAddress = createSiteNodeWizardInfoBean.getReturnAddress(); returnAddress = returnAddress.replaceAll( "#entityId", createSiteNodeWizardInfoBean.getSiteNodeVO().getId().toString()); returnAddress = returnAddress.replaceAll("#path", createSiteNodeWizardInfoBean.getSiteNodeVO().getName()); this.invalidateCreateSiteNodeWizardInfoBean(); this.getResponse().sendRedirect(returnAddress); } catch (Exception e) { e.printStackTrace(); } return NONE; }