Skip to content
Snippets Groups Projects
Commit 99a12455 authored by pkupczyk's avatar pkupczyk
Browse files

BIS-151/SP-550 : openbis.js - represent Long fields as strings in JSON - make...

BIS-151/SP-550 : openbis.js - represent Long fields as strings in JSON - make both dependency checks and GWT compilation work

SVN: 28630
parent d63718df
No related branches found
No related tags found
No related merge requests found
Showing
with 63 additions and 9 deletions
...@@ -22,14 +22,28 @@ package ch.systemsx.cisd.openbis.generic.shared.api.v1.util; ...@@ -22,14 +22,28 @@ package ch.systemsx.cisd.openbis.generic.shared.api.v1.util;
public class JsonPropertyUtil public class JsonPropertyUtil
{ {
/*
* Unfortunately some of our API DTOs are not in the API packages or refer to classes that are
* not in the API packages (for instance classes in
* ch.systemsx.cisd.openbis.generic.shared.basic.dto package). To make things even worse these
* classes are reused in both the API and in GWT. Creating a utility class that is reused by all
* these DTOs is therefore impossible. If that utility class is located in the API package then
* it won't be available in GWT. On the other hand if it is located in a GWT module then is
* breaks the API code independence. Until we don't fix the DTOs the best we can do is to have
* two JsonPropertyUtil classes. Once we have all API DTOs is the API packages the other
* JsonPropertyUtil class can be removed.
*/
public static final String toStringOrNull(final Long longOrNull) public static final String toStringOrNull(final Long longOrNull)
{ {
return longOrNull == null ? null : longOrNull.toString(); return ch.systemsx.cisd.openbis.generic.shared.basic.util.JsonPropertyUtil
.toStringOrNull(longOrNull);
} }
public static final Long toLongOrNull(final String stringOrNull) public static final Long toLongOrNull(final String stringOrNull)
{ {
return stringOrNull == null ? null : Long.valueOf(stringOrNull); return ch.systemsx.cisd.openbis.generic.shared.basic.util.JsonPropertyUtil
.toLongOrNull(stringOrNull);
} }
} }
...@@ -25,8 +25,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore; ...@@ -25,8 +25,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import ch.systemsx.cisd.base.annotation.JsonObject; import ch.systemsx.cisd.base.annotation.JsonObject;
import ch.systemsx.cisd.openbis.generic.shared.api.v1.util.JsonPropertyUtil;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder;
import ch.systemsx.cisd.openbis.generic.shared.basic.util.JsonPropertyUtil;
/** /**
* Technical identifier of an entity. * Technical identifier of an entity.
......
...@@ -20,7 +20,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; ...@@ -20,7 +20,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import ch.systemsx.cisd.base.annotation.JsonObject; import ch.systemsx.cisd.base.annotation.JsonObject;
import ch.systemsx.cisd.openbis.generic.shared.api.v1.util.JsonPropertyUtil; import ch.systemsx.cisd.openbis.generic.shared.basic.util.JsonPropertyUtil;
/** /**
* @author Franz-Josef Elmer * @author Franz-Josef Elmer
......
...@@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; ...@@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import ch.systemsx.cisd.base.annotation.JsonObject; import ch.systemsx.cisd.base.annotation.JsonObject;
import ch.systemsx.cisd.openbis.generic.shared.api.v1.util.JsonPropertyUtil; import ch.systemsx.cisd.openbis.generic.shared.basic.util.JsonPropertyUtil;
/** /**
* @author Pawel Glyzewski * @author Pawel Glyzewski
......
...@@ -23,8 +23,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore; ...@@ -23,8 +23,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import ch.systemsx.cisd.base.annotation.JsonObject; import ch.systemsx.cisd.base.annotation.JsonObject;
import ch.systemsx.cisd.openbis.generic.shared.api.v1.util.JsonPropertyUtil;
import ch.systemsx.cisd.openbis.generic.shared.basic.IIdAndCodeHolder; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdAndCodeHolder;
import ch.systemsx.cisd.openbis.generic.shared.basic.util.JsonPropertyUtil;
/** /**
* @author Pawel Glyzewski * @author Pawel Glyzewski
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
package ch.systemsx.cisd.openbis.generic.shared.basic.dto; package ch.systemsx.cisd.openbis.generic.shared.basic.dto;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
...@@ -24,7 +24,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; ...@@ -24,7 +24,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import ch.systemsx.cisd.base.annotation.JsonObject; import ch.systemsx.cisd.base.annotation.JsonObject;
import ch.systemsx.cisd.common.reflection.CollectionMapping; import ch.systemsx.cisd.common.reflection.CollectionMapping;
import ch.systemsx.cisd.openbis.generic.shared.api.v1.util.JsonPropertyUtil; import ch.systemsx.cisd.openbis.generic.shared.basic.util.JsonPropertyUtil;
/** /**
* Controlled vocabulary. * Controlled vocabulary.
......
...@@ -21,7 +21,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; ...@@ -21,7 +21,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import ch.systemsx.cisd.base.annotation.JsonObject; import ch.systemsx.cisd.base.annotation.JsonObject;
import ch.systemsx.cisd.common.parser.BeanProperty; import ch.systemsx.cisd.common.parser.BeanProperty;
import ch.systemsx.cisd.openbis.generic.shared.api.v1.util.JsonPropertyUtil; import ch.systemsx.cisd.openbis.generic.shared.basic.util.JsonPropertyUtil;
/** /**
* A vocabulary term. * A vocabulary term.
......
/*
* Copyright 2013 ETH Zuerich, CISD
*
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.systemsx.cisd.openbis.generic.shared.basic.util;
/**
* @author pkupczyk
*/
public class JsonPropertyUtil
{
/*
* This class should be removed once we clean our API DTOs - see comment in {@link
* ch.systemsx.cisd.openbis.generic.shared.api.v1.util.JsonPropertyUtil}
*/
public static final String toStringOrNull(final Long longOrNull)
{
return longOrNull == null ? null : longOrNull.toString();
}
public static final Long toLongOrNull(final String stringOrNull)
{
return stringOrNull == null ? null : Long.valueOf(stringOrNull);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment