예제 #1
0
  @Override
  public ReturnCode save(final Item item, final boolean careDependency) {
    ReturnCode rc = new ReturnCode();
    RepositoryWorkUnit<Object> repositoryWorkUnit =
        new RepositoryWorkUnit<Object>("save DQRule item") { // $NON-NLS-1$

          @Override
          protected void run() throws LoginException, PersistenceException {

            TDQBusinessRuleItem ruleItem = (TDQBusinessRuleItem) item;
            DQRule rule = ruleItem.getDqrule();
            // MOD yyi 2012-02-07 TDQ-4621:Update dependencies(connection) when careDependency is
            // true.
            if (careDependency) {
              saveWithDependencies(ruleItem, rule);
            } else {
              saveWithoutDependencies(ruleItem, rule);
            }
          }
        };
    repositoryWorkUnit.setAvoidUnloadResources(true);
    ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(repositoryWorkUnit);
    try {
      repositoryWorkUnit.throwPersistenceExceptionIfAny();
    } catch (PersistenceException e) {
      log.error(e, e);
      rc.setOk(Boolean.FALSE);
      rc.setMessage(e.getMessage());
    }
    return rc;
  }
 /* (non-Javadoc)
  * @see org.talend.repository.ui.wizards.CheckLastVersionRepositoryWizard#performFinish()
  */
 public boolean performFinish() {
   if (this.sapTablePage.isPageComplete()) {
     RepositoryUpdateManager.updateSAPFunction(sapTablePage.getFunctionUnit());
     ProxyRepositoryFactory localProxyRepositoryFactory = ProxyRepositoryFactory.getInstance();
     try {
       localProxyRepositoryFactory.save(this.repositoryObject.getProperty().getItem());
       RepositoryManager.refresh(ERepositoryObjectType.METADATA_SAP_FUNCTION);
       closeLockStrategy();
     } catch (PersistenceException persistenceException) {
       String message = persistenceException.toString();
       new ErrorDialogWidthDetailArea(
           getShell(),
           "org.talend.repository",
           Messages.getString("CommonWizard.persistenceException"),
           message);
       log.error(Messages.getString("CommonWizard.persistenceException") + "\n" + message);
     }
   }
   return true;
 }