protected void doExecute() throws Exception {
    File inputFile = new File(serviceFileName);

    if (!inputFile.exists()) {
      getLog().warn(inputFile.getAbsolutePath() + " does not exist");

      return;
    }

    getLog().info("Building from " + serviceFileName);

    PropsUtil.set("spring.configs", "META-INF/service-builder-spring.xml");
    PropsUtil.set(PropsKeys.RESOURCE_ACTIONS_READ_PORTLET_RESOURCES, "false");

    InitUtil.initWithSpring();

    new ServiceBuilder(
        serviceFileName,
        hbmFileName,
        ormFileName,
        modelHintsFileName,
        springFileName,
        springBaseFileName,
        null,
        springDynamicDataSourceFileName,
        springHibernateFileName,
        springInfrastructureFileName,
        springShardDataSourceFileName,
        apiDir,
        implDir,
        jsonFileName,
        null,
        sqlDir,
        sqlFileName,
        sqlIndexesFileName,
        sqlIndexesPropertiesFileName,
        sqlSequencesFileName,
        autoNamespaceTables,
        beanLocatorUtil,
        propsUtil,
        pluginName,
        null);
  }
예제 #2
0
  protected void checkWebSettings(String xml) throws DocumentException {
    Document doc = SAXReaderUtil.read(xml);

    Element root = doc.getRootElement();

    int timeout = PropsValues.SESSION_TIMEOUT;

    Element sessionConfig = root.element("session-config");

    if (sessionConfig != null) {
      String sessionTimeout = sessionConfig.elementText("session-timeout");

      timeout = GetterUtil.getInteger(sessionTimeout, timeout);
    }

    PropsUtil.set(PropsKeys.SESSION_TIMEOUT, String.valueOf(timeout));

    PropsValues.SESSION_TIMEOUT = timeout;

    I18nServlet.setLanguageIds(root);
    I18nFilter.setLanguageIds(I18nServlet.getLanguageIds());
  }
  protected void doUpgrade() throws Exception {

    // JournalArticle

    UpgradeColumn upgradeCompanyIdColumn =
        new SwapUpgradeColumnImpl(
            "companyId", new Integer(Types.VARCHAR), AvailableMappersUtil.getCompanyIdMapper());

    UpgradeColumn upgradeGroupIdColumn =
        new SwapUpgradeColumnImpl("groupId", AvailableMappersUtil.getGroupIdMapper());

    UpgradeColumn upgradeUserIdColumn =
        new SwapUpgradeColumnImpl(
            "userId", new Integer(Types.VARCHAR), AvailableMappersUtil.getUserIdMapper());

    UpgradeColumn upgradeApprovedByUserIdColumn =
        new SwapUpgradeColumnImpl(
            "approvedByUserId", new Integer(Types.VARCHAR), AvailableMappersUtil.getUserIdMapper());

    JournalArticlePKUpgradeColumnImpl upgradeArticlePKColumn =
        new JournalArticlePKUpgradeColumnImpl(upgradeCompanyIdColumn, upgradeGroupIdColumn);

    UpgradeColumn upgradeArticleResourcePrimKeyColumn =
        new JournalArticleResourcePrimKeyUpgradeColumnImpl(upgradeArticlePKColumn);

    UpgradeColumn upgradeArticleIdColumn = new TempUpgradeColumnImpl("articleId");

    UpgradeColumn upgradeVersionColumn =
        new TempUpgradeColumnImpl("version", new Integer(Types.DOUBLE));

    UpgradeColumn upgradeStructureIdColumn = new TempUpgradeColumnImpl("structureId");

    UpgradeColumn upgradeContentColumn =
        new JournalArticleContentUpgradeColumnImpl(
            upgradeCompanyIdColumn,
            upgradeGroupIdColumn,
            upgradeArticleIdColumn,
            upgradeVersionColumn,
            upgradeStructureIdColumn,
            AvailableMappersUtil.getImageIdMapper());

    UpgradeTable upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            JournalArticleTable.TABLE_NAME,
            JournalArticleTable.TABLE_COLUMNS,
            upgradeCompanyIdColumn,
            upgradeGroupIdColumn,
            upgradeUserIdColumn,
            upgradeApprovedByUserIdColumn,
            upgradeArticlePKColumn,
            upgradeArticleResourcePrimKeyColumn,
            upgradeArticleIdColumn,
            upgradeVersionColumn,
            upgradeStructureIdColumn,
            upgradeContentColumn);

    upgradeTable.setCreateSQL(JournalArticleTable.TABLE_SQL_CREATE);
    upgradeTable.setIndexesSQL(JournalArticleTable.TABLE_SQL_ADD_INDEXES);

    upgradeTable.updateTable();

    ValueMapper articleIdMapper = new DefaultPKMapper(upgradeArticlePKColumn.getValueMapper());

    AvailableMappersUtil.setJournalArticleIdMapper(articleIdMapper);

    // JournalStructure

    PKUpgradeColumnImpl upgradeStructurePKColumn =
        new JournalStructurePKUpgradeColumnImpl(upgradeCompanyIdColumn, upgradeGroupIdColumn);

    UpgradeColumn upgradeXSDColumn = new JournalStructureXSDUpgradeColumnImpl();

    upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            JournalStructureTable.TABLE_NAME,
            JournalStructureTable.TABLE_COLUMNS,
            upgradeCompanyIdColumn,
            upgradeGroupIdColumn,
            upgradeStructurePKColumn,
            upgradeUserIdColumn,
            upgradeXSDColumn);

    upgradeTable.setCreateSQL(JournalStructureTable.TABLE_SQL_CREATE);
    upgradeTable.setIndexesSQL(JournalStructureTable.TABLE_SQL_ADD_INDEXES);

    upgradeTable.updateTable();

    ValueMapper structureIdMapper = new DefaultPKMapper(upgradeStructurePKColumn.getValueMapper());

    AvailableMappersUtil.setJournalStructureIdMapper(structureIdMapper);

    // JournalTemplate

    PKUpgradeColumnImpl upgradeTemplatePKColumn =
        new JournalTemplatePKUpgradeColumnImpl(upgradeCompanyIdColumn, upgradeGroupIdColumn);

    UpgradeColumn upgradeTemplateIdColumn = new TempUpgradeColumnImpl("templateId");

    UpgradeColumn upgradeXSLColumn =
        new JournalTemplateXSLUpgradeColumnImpl(upgradeTemplateIdColumn);

    UpgradeColumn upgradeSmallImageIdColumn =
        new JournalTemplateSmallImageIdUpgradeColumnImpl(
            upgradeCompanyIdColumn,
            upgradeGroupIdColumn,
            upgradeTemplatePKColumn,
            AvailableMappersUtil.getImageIdMapper());

    upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            JournalTemplateTable.TABLE_NAME,
            JournalTemplateTable.TABLE_COLUMNS,
            upgradeCompanyIdColumn,
            upgradeGroupIdColumn,
            upgradeTemplatePKColumn,
            upgradeUserIdColumn,
            upgradeTemplateIdColumn,
            upgradeXSLColumn,
            upgradeSmallImageIdColumn);

    upgradeTable.setCreateSQL(JournalTemplateTable.TABLE_SQL_CREATE);
    upgradeTable.setIndexesSQL(JournalTemplateTable.TABLE_SQL_ADD_INDEXES);

    upgradeTable.updateTable();

    ValueMapper templateIdMapper = new DefaultPKMapper(upgradeTemplatePKColumn.getValueMapper());

    AvailableMappersUtil.setJournalTemplateIdMapper(templateIdMapper);

    // JournalContentSearch

    PropsUtil.set(PropsKeys.JOURNAL_SYNC_CONTENT_SEARCH_ON_STARTUP, "true");
  }