Skip to content

Commit

Permalink
Added array
Browse files Browse the repository at this point in the history
  • Loading branch information
jorizci committed Aug 17, 2018
1 parent abf9e30 commit 5817485
Show file tree
Hide file tree
Showing 12 changed files with 486 additions and 1 deletion.
26 changes: 26 additions & 0 deletions src/main/java/uk/ac/ebi/ega/accession/array/model/Array.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
*
* Copyright 2018 EMBL - European Bioinformatics Institute
*
* 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 uk.ac.ebi.ega.accession.array.model;

public interface Array {

String getSubmissionAccount();

String getAlias();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
*
* Copyright 2018 EMBL - European Bioinformatics Institute
*
* 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 uk.ac.ebi.ega.accession.array.persistence;

import uk.ac.ebi.ampt2d.commons.accession.core.models.AccessionWrapper;
import uk.ac.ebi.ampt2d.commons.accession.persistence.jpa.entities.AccessionedEntity;
import uk.ac.ebi.ega.accession.array.model.Array;

import javax.persistence.Column;
import javax.persistence.Entity;

@Entity
public class ArrayEntity extends AccessionedEntity<Array, Long> implements Array {

@Column(nullable = false)
private String submissionAccount;

@Column(nullable = false)
private String alias;

ArrayEntity() {
super(null, null, -1);
}

public ArrayEntity(Array array, Long accession, String hashedMessage, int version) {
super(hashedMessage, accession, version);
this.submissionAccount = array.getSubmissionAccount();
this.alias = array.getAlias();
}

public ArrayEntity(AccessionWrapper<Array, String, Long> wrapper) {
this(wrapper.getData(), wrapper.getAccession(), wrapper.getHash(), wrapper.getVersion());
}

@Override
public Array getModel() {
return this;
}

@Override
public String getSubmissionAccount() {
return submissionAccount;
}

@Override
public String getAlias() {
return alias;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
*
* Copyright 2018 EMBL - European Bioinformatics Institute
*
* 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 uk.ac.ebi.ega.accession.array.persistence;

import org.springframework.stereotype.Repository;
import uk.ac.ebi.ampt2d.commons.accession.persistence.repositories.IAccessionedObjectRepository;

@Repository
public interface ArrayEntityRepository extends IAccessionedObjectRepository<ArrayEntity, Long> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
*
* Copyright 2018 EMBL - European Bioinformatics Institute
*
* 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 uk.ac.ebi.ega.accession.array.persistence;

import org.springframework.transaction.PlatformTransactionManager;
import uk.ac.ebi.ampt2d.commons.accession.persistence.jpa.repositories.BasicJpaAccessionedObjectCustomRepositoryImpl;

import javax.persistence.EntityManager;

public class ArrayEntityRepositoryImpl extends BasicJpaAccessionedObjectCustomRepositoryImpl<Long, ArrayEntity> {

public ArrayEntityRepositoryImpl(PlatformTransactionManager platformTransactionManager, EntityManager entityManager) {
super(ArrayEntity.class, platformTransactionManager, entityManager);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
*
* Copyright 2018 EMBL - European Bioinformatics Institute
*
* 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 uk.ac.ebi.ega.accession.array.persistence;

import uk.ac.ebi.ampt2d.commons.accession.persistence.jpa.entities.InactiveAccessionEntity;
import uk.ac.ebi.ega.accession.array.model.Array;

import javax.persistence.Column;
import javax.persistence.Entity;

@Entity
public class HistoricArrayEntity extends InactiveAccessionEntity<Array, Long> implements Array {

@Column(nullable = false)
private String submissionAccount;

@Column(nullable = false)
private String alias;

HistoricArrayEntity() {
super();
}

public HistoricArrayEntity(ArrayEntity entity) {
super(entity);
this.submissionAccount = entity.getSubmissionAccount();
this.alias = entity.getAlias();
}

@Override
public Array getModel() {
return this;
}

@Override
public String getSubmissionAccount() {
return submissionAccount;
}

@Override
public String getAlias() {
return alias;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
*
* Copyright 2018 EMBL - European Bioinformatics Institute
*
* 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 uk.ac.ebi.ega.accession.array.persistence;

import org.springframework.stereotype.Repository;
import uk.ac.ebi.ampt2d.commons.accession.persistence.jpa.repositories.InactiveAccessionRepository;

@Repository
public interface HistoricArrayRepository extends InactiveAccessionRepository<HistoricArrayEntity> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
*
* Copyright 2018 EMBL - European Bioinformatics Institute
*
* 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 uk.ac.ebi.ega.accession.array.persistence;

import uk.ac.ebi.ampt2d.commons.accession.persistence.jpa.entities.OperationEntity;

import javax.persistence.Entity;

@Entity
public class HistoricLogArrayEntity extends OperationEntity<Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
*
* Copyright 2018 EMBL - European Bioinformatics Institute
*
* 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 uk.ac.ebi.ega.accession.array.persistence;

import org.springframework.stereotype.Repository;
import uk.ac.ebi.ampt2d.commons.accession.persistence.repositories.IHistoryRepository;

@Repository
public interface HistoricLogArrayRepository extends IHistoryRepository<Long, HistoricLogArrayEntity, Long> {

}
51 changes: 51 additions & 0 deletions src/main/java/uk/ac/ebi/ega/accession/array/rest/ArrayDTO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
*
* Copyright 2018 EMBL - European Bioinformatics Institute
*
* 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 uk.ac.ebi.ega.accession.array.rest;

import uk.ac.ebi.ega.accession.array.model.Array;

import javax.persistence.Column;

public class ArrayDTO implements Array {

@Column(nullable = false)
private String submissionAccount;

@Column(nullable = false)
private String alias;

public ArrayDTO(Array array) {
this(array.getSubmissionAccount(), array.getAlias());
}

public ArrayDTO(String submissionAccount, String alias) {
this.submissionAccount = submissionAccount;
this.alias = alias;
}

@Override
public String getSubmissionAccount() {
return submissionAccount;
}

@Override
public String getAlias() {
return alias;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
*
* Copyright 2018 EMBL - European Bioinformatics Institute
*
* 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 uk.ac.ebi.ega.accession.array.rest;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import uk.ac.ebi.ampt2d.commons.accession.core.AccessioningService;
import uk.ac.ebi.ampt2d.commons.accession.rest.controllers.BasicRestController;
import uk.ac.ebi.ega.accession.array.model.Array;

@RestController
@RequestMapping(value = "/v1/array")
public class ArrayRestController extends BasicRestController<ArrayDTO, Array, String, String> {

public ArrayRestController(AccessioningService<Array, String, String> arrayAccessionService) {
super(arrayAccessionService, ArrayDTO::new);
}

}
Loading

0 comments on commit 5817485

Please sign in to comment.