Skip to content

Commit

Permalink
Merge branch 'release/2022-10-rc1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-gomes committed Nov 3, 2022
2 parents 8b9434d + 3565a8c commit 962dcbf
Show file tree
Hide file tree
Showing 673 changed files with 1,304,305 additions and 937,159 deletions.
4 changes: 2 additions & 2 deletions app/controllers/BranchController.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ public BranchController(BranchService branchService, MetamodelProvider metamodel
public Result postBranchByProject(UUID projectId, Request request) {
JsonNode requestBodyJson = request.body().asJson();
Branch requestedObject = Json.fromJson(requestBodyJson, metamodelProvider.getImplementationClass(Branch.class));
if (requestedObject.getId() != null || requestedObject.getTimestamp() != null) {
if (requestedObject.getId() != null || requestedObject.getCreated() != null) {
return Results.badRequest();
}
requestedObject.setTimestamp(ZonedDateTime.now());
requestedObject.setCreated(ZonedDateTime.now());
Optional<Branch> branch = branchService.create(projectId, requestedObject);
if (branch.isEmpty()) {
return Results.internalServerError();
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/CommitController.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ public Result postCommitByProjectNameResolved(UUID projectId, @SuppressWarnings(
private Result postCommitByProject(UUID projectId, @SuppressWarnings("OptionalUsedAsFieldOrParameterType") Optional<UUID> branchId, Request request, CommitCreator creator) {
JsonNode requestBodyJson = request.body().asJson();
Commit requestedObject = Json.fromJson(requestBodyJson, metamodelProvider.getImplementationClass(Commit.class));
if (requestedObject.getId() != null || requestedObject.getTimestamp() != null) {
if (requestedObject.getId() != null || requestedObject.getCreated() != null) {
return Results.badRequest();
}
requestedObject.setTimestamp(ZonedDateTime.now());
requestedObject.setCreated(ZonedDateTime.now());
Optional<Commit> commit = creator.create(projectId, branchId.orElse(null), requestedObject);
if (commit.isEmpty()) {
return Results.internalServerError();
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/TagController.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public TagController(TagService tagService, MetamodelProvider metamodelProvider,
public Result postTagByProject(UUID projectId, Request request) {
JsonNode requestBodyJson = request.body().asJson();
Tag requestedObject = Json.fromJson(requestBodyJson, metamodelProvider.getImplementationClass(Tag.class));
if (requestedObject.getId() != null || requestedObject.getTimestamp() != null) {
if (requestedObject.getId() != null || requestedObject.getCreated() != null) {
return Results.badRequest();
}
requestedObject.setTimestamp(ZonedDateTime.now());
requestedObject.setCreated(ZonedDateTime.now());
Optional<Tag> tag = tagService.create(projectId, requestedObject);
if (tag.isEmpty()) {
return Results.internalServerError();
Expand Down
18 changes: 13 additions & 5 deletions app/dao/impl/FlatSchemaDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.Streams;
import config.MetamodelProvider;
import dao.SchemaDao;
import jackson.databind.ObjectMapperFactory;
import org.omg.sysml.data.ExternalData;
import org.omg.sysml.data.ExternalRelationship;
import org.omg.sysml.data.ProjectUsage;

import javax.annotation.Nullable;
import javax.inject.Inject;
Expand All @@ -47,10 +50,15 @@ public class FlatSchemaDao implements SchemaDao {
public FlatSchemaDao(MetamodelProvider metamodelProvider, ObjectMapperFactory mapperFactory) {
this.mapper = mapperFactory.getObjectMapper();
try (Stream<Class<?>> interfaces = metamodelProvider.getAllInterfaces().stream()) {
map = interfaces
.map(type -> FlatSchemaDao.class.getResourceAsStream(String.format("/json/schema/sysml/%s.json",
type.getSimpleName())))
.filter(Objects::nonNull)
map = Streams.concat(
interfaces
.map(type -> FlatSchemaDao.class.getResourceAsStream(String.format("/json/schema/lang/%s.json",
type.getSimpleName())))
.filter(Objects::nonNull),
Stream.of(ExternalData.class, ExternalRelationship.class, ProjectUsage.class)
.map(type -> FlatSchemaDao.class.getResourceAsStream(String.format("/json/schema/api/%s.json",
type.getSimpleName())))
)
.map(input -> {
try {
return mapper.reader().readTree(input);
Expand Down
8 changes: 4 additions & 4 deletions app/dao/impl/jpa/JpaDataDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.omg.sysml.internal.impl.WorkingDataVersionImpl;
import org.omg.sysml.lifecycle.Commit;
import org.omg.sysml.lifecycle.Data;
import org.omg.sysml.lifecycle.DataIdentity;
import org.omg.sysml.lifecycle.DataVersion;
import org.omg.sysml.lifecycle.impl.CommitImpl;
import org.omg.sysml.query.*;
Expand Down Expand Up @@ -96,7 +95,7 @@ public List<Data> findByCommitAndQuery(Commit commit, Query query) {
Commit c = em.contains(commit) ? commit : em.find(CommitImpl.class, commit.getId());
Query q = query.getId() == null || em.contains(query) ? query : em.find(QueryImpl.class, query.getId());
return getCommitIndex(c, em).getWorkingDataVersion().stream()
.filter(scope(q))
// .filter(scope(q))
.map(WorkingDataVersion::getDataVersion)
.map(DataVersion::getPayload)
.filter(constrain(q.getWhere()))
Expand Down Expand Up @@ -155,7 +154,7 @@ protected Stream<WorkingDataVersion> streamWorkingDataVersions(Commit commit, En

Set<WorkingDataVersion> _usedDataVersions = ConcurrentHashMap.newKeySet();
for (ProjectUsage projectUsage : projectUsages) {
Commit usedCommit = projectUsage.getUsedProjectCommit();
Commit usedCommit = projectUsage.getUsedCommit();
if (usedCommit == null) {
continue;
}
Expand Down Expand Up @@ -263,7 +262,7 @@ else if (constraint instanceof CompositeConstraint) {
throw new IllegalArgumentException("Unknown constraint type: " + constraint.getClass().getSimpleName());
}
}

/*
protected Predicate<WorkingDataVersion> scope(Query query) {
if (query.getScope() == null || query.getScope().isEmpty()) {
return ev -> true;
Expand All @@ -272,4 +271,5 @@ protected Predicate<WorkingDataVersion> scope(Query query) {
.map(DataIdentity::getId)
.anyMatch(id -> Objects.equals(id, working.getDataVersion().getIdentity().getId()));
}
*/
}
3 changes: 1 addition & 2 deletions app/dao/impl/jpa/JpaProjectDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import javax.inject.Singleton;
import java.time.ZonedDateTime;
import java.util.Optional;
import java.util.UUID;

@Singleton
public class JpaProjectDao extends SimpleJpaDao<Project, ProjectImpl> implements ProjectDao {
Expand All @@ -61,7 +60,7 @@ public Optional<Project> persist(Project project) {
defaultBranch.setOwningProject(project);
defaultBranch.setName(Project.DEFAULT_BRANCH_NAME);
// TODO Add timestamp to Project and inherit into defaultBranch
defaultBranch.setTimestamp(ZonedDateTime.now());
defaultBranch.setCreated(ZonedDateTime.now());
project.setDefaultBranch(defaultBranch);
return super.persist(project);
}
Expand Down
2 changes: 2 additions & 0 deletions app/dao/impl/jpa/JpaQueryDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ public JpaQueryDao(JPAManager jpaManager) {
@Override
public Optional<Query> persist(Query query) {
return jpaManager.transact(em -> {
/*
query.setScope(
query.getScope().stream()
.filter(identity -> Objects.nonNull(identity.getId()))
.map(em::merge)
.collect(Collectors.toSet())
);
*/
return super.persist(query, em);
});
}
Expand Down
8 changes: 4 additions & 4 deletions app/org/omg/sysml/data/ExternalRelationship.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@

public interface ExternalRelationship extends Data {

String getSpecification();

String getLanguage();

Element getElementEnd();

ExternalData getExternalDataEnd();

String getLanguage();

String getSpecification();
}
2 changes: 1 addition & 1 deletion app/org/omg/sysml/data/ProjectUsage.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

public interface ProjectUsage extends Data {

Commit getUsedProjectCommit();
Commit getUsedCommit();

Project getUsedProject();
}
44 changes: 22 additions & 22 deletions app/org/omg/sysml/data/impl/ExternalRelationshipImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,6 @@ public void setId(UUID id) {
this.id = id;
}

private String specification;

@JsonGetter
@Column(name = "specification", table = "ExternalRelationship")
public String getSpecification() { return specification; }

@JsonSetter
public void setSpecification(String specification) {
this.specification = specification;
}

private String language;

@JsonGetter
@Column(name = "language", table = "ExternalRelationship")
public String getLanguage() { return language; }

@JsonSetter
public void setLanguage(String language) {
this.language = language;
}

private Element elementEnd;

@JsonGetter
Expand Down Expand Up @@ -117,4 +95,26 @@ public ExternalData getExternalDataEnd() {
public void setExternalDataEnd(ExternalData externalDataEnd) {
this.externalDataEnd = externalDataEnd;
}

private String language;

@JsonGetter
@Column(name = "language", table = "ExternalRelationship")
public String getLanguage() { return language; }

@JsonSetter
public void setLanguage(String language) {
this.language = language;
}

private String specification;

@JsonGetter
@Column(name = "specification", table = "ExternalRelationship")
public String getSpecification() { return specification; }

@JsonSetter
public void setSpecification(String specification) {
this.specification = specification;
}
}
18 changes: 9 additions & 9 deletions app/org/omg/sysml/data/impl/ProjectUsageImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,30 +63,30 @@ public void setId(UUID id) {
this.id = id;
}

private Commit usedProjectCommit;
private Commit usedCommit;

@JsonGetter
@JsonSerialize(using = RecordSerialization.RecordSerializer.class)
@ManyToOne(targetEntity = CommitImpl.class, fetch = FetchType.LAZY)
@JoinColumn(name = "usedProjectCommitId", table = "ProjectUsage")
public Commit getUsedProjectCommit() {
return usedProjectCommit;
@JoinColumn(name = "usedCommitId", table = "ProjectUsage")
public Commit getUsedCommit() {
return usedCommit;
}

@JsonSetter
@JsonDeserialize(as = CommitImpl.class, using = RecordSerialization.CommitDeserializer.class)
public void setUsedProjectCommit(Commit usedProjectCommit) {
this.usedProjectCommit = usedProjectCommit;
public void setUsedCommit(Commit usedCommit) {
this.usedCommit = usedCommit;
}

@Override
@Transient
@JsonSerialize(as = ProjectImpl.class, using = RecordSerialization.RecordSerializer.class)
public Project getUsedProject() {
Commit usedProjectCommit = getUsedProjectCommit();
if (usedProjectCommit == null) {
Commit usedCommit = getUsedCommit();
if (usedCommit == null) {
return null;
}
return usedProjectCommit.getOwningProject();
return usedCommit.getOwningProject();
}
}
4 changes: 2 additions & 2 deletions app/org/omg/sysml/lifecycle/Commit.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public interface Commit extends Record {

void setPreviousCommit(Commit previousCommit);

ZonedDateTime getTimestamp();
ZonedDateTime getCreated();

void setTimestamp(ZonedDateTime timestamp);
void setCreated(ZonedDateTime created);
}
4 changes: 2 additions & 2 deletions app/org/omg/sysml/lifecycle/CommitReference.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface CommitReference extends Record {

Commit getReferencedCommit();

ZonedDateTime getTimestamp();
ZonedDateTime getCreated();

void setTimestamp(ZonedDateTime timestamp);
void setCreated(ZonedDateTime created);
}
10 changes: 5 additions & 5 deletions app/org/omg/sysml/lifecycle/impl/BranchImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class BranchImpl extends RecordImpl implements Branch {
private Project owningProject;
private Commit head;
private String name;
private ZonedDateTime timestamp;
private ZonedDateTime created;

@Override
@ManyToOne(targetEntity = ProjectImpl.class, fetch = FetchType.LAZY)
Expand Down Expand Up @@ -91,12 +91,12 @@ public void setName(String name) {

@Override
@Column
public ZonedDateTime getTimestamp() {
return timestamp;
public ZonedDateTime getCreated() {
return created;
}

public void setTimestamp(ZonedDateTime timestamp) {
this.timestamp = timestamp;
public void setCreated(ZonedDateTime created) {
this.created = created;
}

@Transient
Expand Down
10 changes: 5 additions & 5 deletions app/org/omg/sysml/lifecycle/impl/CommitImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
public class CommitImpl extends RecordImpl implements Commit {
private Project owningProject;
private Set<DataVersion> change;
private ZonedDateTime timestamp;
private ZonedDateTime created;
private Commit previousCommit;

@Override
Expand Down Expand Up @@ -74,12 +74,12 @@ public void setChange(Set<DataVersion> change) {
@Override
@Column
@JsonView(Views.Compact.class)
public ZonedDateTime getTimestamp() {
return timestamp;
public ZonedDateTime getCreated() {
return created;
}

public void setTimestamp(ZonedDateTime timestamp) {
this.timestamp = timestamp;
public void setCreated(ZonedDateTime created) {
this.created = created;
}

@ManyToOne(targetEntity = CommitImpl.class, fetch = FetchType.LAZY)
Expand Down
10 changes: 5 additions & 5 deletions app/org/omg/sysml/lifecycle/impl/TagImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class TagImpl extends RecordImpl implements Tag {
private Project owningProject;
private Commit taggedCommit;
private String name;
private ZonedDateTime timestamp;
private ZonedDateTime created;

@Override
@ManyToOne(targetEntity = ProjectImpl.class, fetch = FetchType.LAZY)
Expand Down Expand Up @@ -88,12 +88,12 @@ public void setName(String name) {

@Override
@Column
public ZonedDateTime getTimestamp() {
return timestamp;
public ZonedDateTime getCreated() {
return created;
}

public void setTimestamp(ZonedDateTime timestamp) {
this.timestamp = timestamp;
public void setCreated(ZonedDateTime created) {
this.created = created;
}

@Transient
Expand Down
3 changes: 0 additions & 3 deletions app/org/omg/sysml/lifecycle/impl/package-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
@MetaValue(value = "ItemFeature", targetEntity = ItemFeatureImpl.class),
@MetaValue(value = "ItemFlow", targetEntity = ItemFlowImpl.class),
@MetaValue(value = "ItemFlowEnd", targetEntity = ItemFlowEndImpl.class),
@MetaValue(value = "ItemFlowFeature", targetEntity = ItemFlowFeatureImpl.class),
@MetaValue(value = "ItemUsage", targetEntity = ItemUsageImpl.class),
@MetaValue(value = "JoinNode", targetEntity = JoinNodeImpl.class),
@MetaValue(value = "LibraryPackage", targetEntity = LibraryPackageImpl.class),
Expand Down Expand Up @@ -164,7 +163,6 @@
@MetaValue(value = "SatisfyRequirementUsage", targetEntity = SatisfyRequirementUsageImpl.class),
@MetaValue(value = "SelectExpression", targetEntity = SelectExpressionImpl.class),
@MetaValue(value = "SendActionUsage", targetEntity = SendActionUsageImpl.class),
@MetaValue(value = "SourceEnd", targetEntity = SourceEndImpl.class),
@MetaValue(value = "Specialization", targetEntity = SpecializationImpl.class),
@MetaValue(value = "StakeholderMembership", targetEntity = StakeholderMembershipImpl.class),
@MetaValue(value = "StateDefinition", targetEntity = StateDefinitionImpl.class),
Expand All @@ -179,7 +177,6 @@
@MetaValue(value = "SuccessionAsUsage", targetEntity = SuccessionAsUsageImpl.class),
@MetaValue(value = "SuccessionFlowConnectionUsage", targetEntity = SuccessionFlowConnectionUsageImpl.class),
@MetaValue(value = "SuccessionItemFlow", targetEntity = SuccessionItemFlowImpl.class),
@MetaValue(value = "TargetEnd", targetEntity = TargetEndImpl.class),
@MetaValue(value = "TextualRepresentation", targetEntity = TextualRepresentationImpl.class),
@MetaValue(value = "TransitionFeatureMembership", targetEntity = TransitionFeatureMembershipImpl.class),
@MetaValue(value = "TransitionUsage", targetEntity = TransitionUsageImpl.class),
Expand Down
2 changes: 0 additions & 2 deletions app/org/omg/sysml/metamodel/Feature.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,4 @@ public interface Feature extends Type, SysMLType {
FeatureDirectionKind getDirection();

ReferenceSubsetting getOwnedReferenceSubsetting();

Boolean getIsNonunique();
}
Loading

0 comments on commit 962dcbf

Please sign in to comment.