Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
a2cf4074
Commit
a2cf4074
authored
11 years ago
by
juanf
Browse files
Options
Downloads
Patches
Plain Diff
SP-624 BIS-398: Ordering Bugfix. Ongoing work.
SVN: 28994
parent
d8226c9d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewETNewPTAssigments.java
+9
-40
9 additions, 40 deletions
...penbis/generic/shared/basic/dto/NewETNewPTAssigments.java
with
9 additions
and
40 deletions
openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewETNewPTAssigments.java
+
9
−
40
View file @
a2cf4074
package
ch.systemsx.cisd.openbis.generic.shared.basic.dto
;
package
ch.systemsx.cisd.openbis.generic.shared.basic.dto
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.List
;
public
class
NewETNewPTAssigments
implements
Serializable
public
class
NewETNewPTAssigments
implements
Serializable
...
@@ -40,6 +38,7 @@ public class NewETNewPTAssigments implements Serializable
...
@@ -40,6 +38,7 @@ public class NewETNewPTAssigments implements Serializable
if
(
entity
.
getAssignedPropertyTypes
().
get
(
i
).
getPropertyType
().
getCode
().
equals
(
code
))
{
if
(
entity
.
getAssignedPropertyTypes
().
get
(
i
).
getPropertyType
().
getCode
().
equals
(
code
))
{
entity
.
getAssignedPropertyTypes
().
remove
(
i
);
entity
.
getAssignedPropertyTypes
().
remove
(
i
);
assigments
.
remove
(
i
);
assigments
.
remove
(
i
);
break
;
}
}
}
}
...
@@ -62,10 +61,11 @@ public class NewETNewPTAssigments implements Serializable
...
@@ -62,10 +61,11 @@ public class NewETNewPTAssigments implements Serializable
}
}
//
//
// Update
Internal
List - Reorder the items due to an insert
// Update List
s
-
This
Reorder the items due to an insert
//
//
EntityTypePropertyType
<?>
newEtpt
=
getEntityTypePropertyType
(
entity
.
getEntityKind
(),
newAssigment
);
//Internal List
EntityTypePropertyType
<?>
newEtpt
=
getEntityTypePropertyType
(
entity
.
getEntityKind
(),
newAssigment
);
switch
(
entity
.
getEntityKind
())
switch
(
entity
.
getEntityKind
())
{
{
case
SAMPLE:
case
SAMPLE:
...
@@ -86,46 +86,15 @@ public class NewETNewPTAssigments implements Serializable
...
@@ -86,46 +86,15 @@ public class NewETNewPTAssigments implements Serializable
break
;
break
;
}
}
//
//External List
// Update Internal List - Second pass set proper positions after reordering
assigments
.
add
(
insertPos
,
newAssigment
);
//
for
(
int
i
=
0
;
i
<
entity
.
getAssignedPropertyTypes
().
size
();
i
++)
{
entity
.
getAssignedPropertyTypes
().
get
(
i
).
setOrdinal
((
long
)
i
+
1
);
}
//
//
// Update
Visible List with in
ternal
l
ist
order
// Update
Ordinal - Internal/Ex
ternal
L
ist
//
//
assigments
.
add
(
newAssigment
);
for
(
int
i
=
0
;
i
<
entity
.
getAssignedPropertyTypes
().
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
entity
.
getAssignedPropertyTypes
().
size
();
i
++)
{
EntityTypePropertyType
<?>
etpt
=
entity
.
getAssignedPropertyTypes
().
get
(
i
);
entity
.
getAssignedPropertyTypes
().
get
(
i
).
setOrdinal
((
long
)
i
+
1
);
String
code
=
etpt
.
getPropertyType
().
getCode
();
assigments
.
get
(
i
).
getAssignment
().
setOrdinal
((
long
)
i
+
1
);
for
(
NewPTNewAssigment
assigment:
assigments
)
{
if
(
assigment
.
getPropertyType
().
getCode
().
equals
(
code
))
{
assigment
.
getAssignment
().
setOrdinal
((
long
)
(
i
+
1
));
}
}
}
//
// Update Visible List order
//
Collections
.
sort
(
assigments
,
new
NewPTNewAssigmentComparator
());
}
private
class
NewPTNewAssigmentComparator
implements
Comparator
<
NewPTNewAssigment
>{
@Override
public
int
compare
(
NewPTNewAssigment
arg0
,
NewPTNewAssigment
arg1
)
{
int
isEqualIfZero
=
0
;
if
(
arg0
.
getAssignment
().
getOrdinal
()
>
arg1
.
getAssignment
().
getOrdinal
())
{
isEqualIfZero
=
1
;
}
else
if
(
arg0
.
getAssignment
().
getOrdinal
()
<
arg1
.
getAssignment
().
getOrdinal
())
{
isEqualIfZero
=
-
1
;
}
return
isEqualIfZero
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment