Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Uploader
Commits
09e82815
Commit
09e82815
authored
Sep 11, 2014
by
igoshin
Browse files
#14050 Seems finished
parent
f0f18312
Changes
2
Hide whitespace changes
Inline
Side-by-side
anno-gui/src/main/java/org/genesys2/anno/gui/DwcaBuilder.java
View file @
09e82815
/**
* Copyright 2014 Global Crop Diversity Trust
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
...
@@ -34,6 +34,9 @@ import org.springframework.beans.factory.annotation.Autowired;
public
class
DwcaBuilder
extends
AbstractModelObject
{
@Autowired
private
DataSourceLoader
dataSourceLoader
;
private
List
<
IDataSource
>
fileRoots
=
new
ArrayList
<
IDataSource
>();
private
String
workspaceFilename
=
null
;
...
...
@@ -236,6 +239,17 @@ public class DwcaBuilder extends AbstractModelObject {
JSONArray
columns
=
sheetJ
.
getJSONArray
(
"columns"
);
List
<
Column
>
columnList
=
new
ArrayList
<
Column
>();
List
<
Object
[]>
rows
=
null
;
try
{
rows
=
dataSourceLoader
.
loadRows
(
sourceSheet
,
200
);
}
catch
(
UnsupportedDataFormatException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
sourceSheet
.
updateData
(
rows
);
List
<
Column
>
loadedColumns
=
sourceSheet
.
getColumns
();
for
(
int
x
=
0
;
x
<
columns
.
length
();
x
++)
{
JSONObject
column
=
columns
.
getJSONObject
(
x
);
...
...
@@ -258,7 +272,16 @@ public class DwcaBuilder extends AbstractModelObject {
if
(
column
.
has
(
"multiple"
))
sourceColumn
.
setMultiple
(
column
.
getBoolean
(
"multiple"
));
columnList
.
add
(
sourceColumn
);
if
(
loadedColumns
.
contains
(
sourceColumn
)){
columnList
.
add
(
sourceColumn
);
}
}
for
(
Column
loadedColumn:
loadedColumns
){
if
(!
columnList
.
contains
(
loadedColumn
)){
columnList
.
add
(
loadedColumns
.
indexOf
(
loadedColumn
),
loadedColumn
);
}
}
sourceSheet
.
setColumns
(
columnList
);
sourceSheetList
.
add
(
sourceSheet
);
...
...
anno-gui/src/main/java/org/genesys2/anno/model/Column.java
View file @
09e82815
...
...
@@ -120,4 +120,18 @@ public class Column extends AbstractModelObject {
this
.
groupPattern
=
groupPattern
;
firePropertyChange
(
"groupPattern"
,
null
,
this
.
groupPattern
);
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Column
column
=
(
Column
)
o
;
if
(
preferredName
!=
null
?
!
preferredName
.
equals
(
column
.
preferredName
)
:
column
.
preferredName
!=
null
)
return
false
;
return
true
;
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment