diff options
author | Martin Stockhammer <martin_s@apache.org> | 2019-08-21 22:44:40 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2019-08-21 22:44:40 +0200 |
commit | 31e8442faddc796db59426a5749ecb64ad76acf5 (patch) | |
tree | a29d7343f31a000ec4b89a90881706a9a22e0ca2 /archiva-modules/metadata/metadata-model | |
parent | 37a92817ef738ea0c0b82aff15605e65de7fc9dd (diff) | |
download | archiva-31e8442faddc796db59426a5749ecb64ad76acf5.tar.gz archiva-31e8442faddc796db59426a5749ecb64ad76acf5.zip |
Fixing TZ for time storage. Adding stream implementations.
Diffstat (limited to 'archiva-modules/metadata/metadata-model')
2 files changed, 36 insertions, 2 deletions
diff --git a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java index c129d1ed8..8bb12d3dd 100644 --- a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java +++ b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java @@ -19,6 +19,8 @@ package org.apache.archiva.metadata.model; * under the License. */ +import sun.reflect.generics.repository.MethodRepository; + import javax.xml.bind.annotation.XmlRootElement; import java.time.Instant; import java.time.LocalDateTime; @@ -39,6 +41,8 @@ import java.util.Date; public class ArtifactMetadata extends FacetedMetadata { + + /** * The artifact ID uniquely identifies an artifact within a given namespace, project and project version. For * example, <tt>archiva-1.4-20100201.345612-2.jar</tt> @@ -145,12 +149,12 @@ public class ArtifactMetadata public void setFileLastModified( long fileLastModified ) { - this.fileLastModified = ZonedDateTime.ofInstant(Instant.ofEpochMilli(fileLastModified), ZoneId.of("GMT")); + this.fileLastModified = ZonedDateTime.ofInstant(Instant.ofEpochMilli(fileLastModified), ModelInfo.STORAGE_TZ); } public void setWhenGathered( ZonedDateTime whenGathered ) { - this.whenGathered = whenGathered; + this.whenGathered = whenGathered.withZoneSameInstant(ModelInfo.STORAGE_TZ); } public void setMd5( String md5 ) diff --git a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ModelInfo.java b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ModelInfo.java new file mode 100644 index 000000000..de1a1c0df --- /dev/null +++ b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ModelInfo.java @@ -0,0 +1,30 @@ +package org.apache.archiva.metadata.model; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +import java.time.ZoneId; + +public interface ModelInfo { + + /** + * The timezone used for storing the time / date information + */ + ZoneId STORAGE_TZ = ZoneId.of("UTC"); +} |