Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
course-material
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IT1901
course-material
Commits
70bbf695
Commit
70bbf695
authored
5 years ago
by
George Adrian Stoica
Browse files
Options
Downloads
Patches
Plain Diff
fixes related to custom and standard properties from MR
!6
parent
f529796c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!6
Issue 11 allow user to enter and update metadata about the latlong points
Pipeline
#53417
passed with stage
Stage:
in 2 minutes and 10 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
simpleexample2/core/src/main/java/simpleex/core/MetaData.java
+38
-10
38 additions, 10 deletions
...leexample2/core/src/main/java/simpleex/core/MetaData.java
with
38 additions
and
10 deletions
simpleexample2/core/src/main/java/simpleex/core/MetaData.java
+
38
−
10
View file @
70bbf695
...
...
@@ -18,6 +18,12 @@ public class MetaData {
*/
public
final
static
String
DESCRIPTION_PROPERTY
=
"description"
;
/**
* the list containing standard properties associated to location metadata
*/
final
public
static
List
<
String
>
STD_PROPERTIES
=
Collections
.
unmodifiableList
(
Arrays
.
asList
(
NAME_PROPERTY
,
DESCRIPTION_PROPERTY
));
private
Collection
<
String
>
tags
;
private
List
<
String
>
properties
;
...
...
@@ -279,13 +285,32 @@ public class MetaData {
}
}
/**
* check if a certain property is custom or standard
* a property is standard when the name is found in STD_PROPERTIES
* @param propertyName the property name to check
* @return true if custom false if standard prop
*/
public
boolean
isCustomProperty
(
String
propertyName
)
{
for
(
String
knownPropertyName
:
STD_PROPERTIES
)
{
if
(
propertyName
==
knownPropertyName
)
{
return
false
;
}
}
return
true
;
}
/**
* Convenience method to check if the metadata contains custom properties
* that is other properties than the name and description
* @return true if there are any properties apart from
name and description
false otherwise
* @return true if there are any properties apart from
standard ones and
false otherwise
*/
public
boolean
hasCustomProperties
()
{
return
hasOtherProperties
(
NAME_PROPERTY
,
DESCRIPTION_PROPERTY
);
for
(
int
i
=
0
;
i
<
this
.
properties
.
size
();
i
=
i
+
2
)
{
String
propertyName
=
this
.
properties
.
get
(
i
);
if
(
isCustomProperty
(
propertyName
))
return
true
;
}
return
false
;
}
/**
...
...
@@ -294,16 +319,19 @@ public class MetaData {
* @return true if there are any properties not in the list, false otherwise
*/
public
boolean
hasOtherProperties
(
String
...
propertyNames
)
{
for
(
int
i
=
0
;
i
<
this
.
properties
.
size
();
i
=
i
+
2
)
{
String
propertyName
=
this
.
properties
.
get
(
i
);
boolean
inList
=
false
;
for
(
int
j
=
0
;
j
<
propertyNames
.
length
;
j
++
)
{
String
knownPropertyName
=
propertyNames
[
j
];
inList
=
inList
||
(
propertyName
==
knownPropertyName
);
}
if
(!
inList
)
return
true
;
outer:
for
(
int
i
=
0
;
i
<
this
.
properties
.
size
();
i
=
i
+
2
)
{
String
propertyName
=
this
.
properties
.
get
(
i
);
for
(
String
knownPropertyName
:
propertyNames
)
{
if
(
propertyName
==
knownPropertyName
)
{
continue
outer
;
}
return
true
;
}
}
return
false
;
}
}
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