2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.io
.berlinModel
.out
;
12 import java
.sql
.ResultSet
;
13 import java
.sql
.SQLException
;
16 import org
.apache
.log4j
.Logger
;
18 import eu
.etaxonomy
.cdm
.io
.common
.CdmIoBase
;
19 import eu
.etaxonomy
.cdm
.io
.common
.ICdmIO
;
20 import eu
.etaxonomy
.cdm
.io
.common
.IExportConfigurator
;
21 import eu
.etaxonomy
.cdm
.io
.common
.MapWrapper
;
22 import eu
.etaxonomy
.cdm
.io
.common
.Source
;
23 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
30 public abstract class BerlinModelExportBase
<T
extends CdmBase
> extends CdmIoBase
<IExportConfigurator
> implements ICdmIO
<IExportConfigurator
> {
31 private static final Logger logger
= Logger
.getLogger(BerlinModelExportBase
.class);
33 public BerlinModelExportBase() {
37 protected abstract boolean doInvoke(BerlinModelExportState
<BerlinModelExportConfigurator
> state
);
40 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#doInvoke(eu.etaxonomy.cdm.io.common.IImportConfigurator, eu.etaxonomy.cdm.api.application.CdmApplicationController, java.util.Map)
43 protected boolean doInvoke(IExportConfigurator config
,
44 Map
<String
, MapWrapper
<?
extends CdmBase
>> stores
){
45 BerlinModelExportState
<BerlinModelExportConfigurator
> state
= ((BerlinModelExportConfigurator
)config
).getState();
46 state
.setConfig((BerlinModelExportConfigurator
)config
);
47 return doInvoke(state
);
50 protected boolean checkSqlServerColumnExists(Source source
, String tableName
, String columnName
){
51 String strQuery
= "SELECT Count(t.id) as n " +
52 " FROM sysobjects AS t " +
53 " INNER JOIN syscolumns AS c ON t.id = c.id " +
54 " WHERE (t.xtype = 'U') AND " +
55 " (t.name = '" + tableName
+ "') AND " +
56 " (c.name = '" + columnName
+ "')";
57 ResultSet rs
= source
.getResultSet(strQuery
) ;
63 } catch (SQLException e
) {
70 public abstract Class
<?
extends CdmBase
> getStandardMethodParameter();
72 protected void doCount(int count
, int modCount
, String pluralString
){
73 if ((count
% modCount
) == 0 && count
!= 0 ){ logger
.info(pluralString
+ " handled: " + (count
));}