http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/taskdetails/TaskDetailsSerializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/taskdetails/TaskDetailsSerializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/taskdetails/TaskDetailsSerializer.java new file mode 100644 index 0000000..30177ce --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/taskdetails/TaskDetailsSerializer.java @@ -0,0 +1,41 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.experiment.taskdetails; + +import org.apache.airavata.model.workspace.experiment.TaskDetails; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TaskDetailsSerializer extends + AbstractThriftSerializer<TaskDetails._Fields, TaskDetails> { + private final static Logger logger = LoggerFactory.getLogger(TaskDetailsSerializer.class); + + @Override + protected TaskDetails._Fields[] getFieldValues() { + return TaskDetails._Fields.values(); + } + + @Override + protected Class<TaskDetails> getThriftClass() { + return null; + } +} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/taskstatus/TaskStatusDeserializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/taskstatus/TaskStatusDeserializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/taskstatus/TaskStatusDeserializer.java new file mode 100644 index 0000000..b2173be --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/taskstatus/TaskStatusDeserializer.java @@ -0,0 +1,44 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.experiment.taskstatus; + +import org.apache.airavata.model.workspace.experiment.TaskStatus; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftDeserializer; +import org.apache.thrift.TException; + +public class TaskStatusDeserializer extends + AbstractThriftDeserializer<TaskStatus._Fields, TaskStatus> { + + @Override + protected TaskStatus._Fields getField(final String fieldName) { + return TaskStatus._Fields.valueOf(fieldName); + } + + @Override + protected TaskStatus newInstance() { + return new TaskStatus(); + } + + @Override + protected void validate(final TaskStatus instance) throws TException { + instance.validate(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/taskstatus/TaskStatusSerializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/taskstatus/TaskStatusSerializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/taskstatus/TaskStatusSerializer.java new file mode 100644 index 0000000..ae56a54 --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/taskstatus/TaskStatusSerializer.java @@ -0,0 +1,41 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.experiment.taskstatus; + +import org.apache.airavata.model.workspace.experiment.TaskStatus; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TaskStatusSerializer extends + AbstractThriftSerializer<TaskStatus._Fields, TaskStatus> { + private final static Logger logger = LoggerFactory.getLogger(TaskStatusSerializer.class); + + @Override + protected TaskStatus._Fields[] getFieldValues() { + return TaskStatus._Fields.values(); + } + + @Override + protected Class<TaskStatus> getThriftClass() { + return null; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/trstatus/TransferStatusDeserializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/trstatus/TransferStatusDeserializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/trstatus/TransferStatusDeserializer.java new file mode 100644 index 0000000..d4bdba2 --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/trstatus/TransferStatusDeserializer.java @@ -0,0 +1,44 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.experiment.trstatus; + +import org.apache.airavata.model.workspace.experiment.TransferStatus; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftDeserializer; +import org.apache.thrift.TException; + +public class TransferStatusDeserializer extends + AbstractThriftDeserializer<TransferStatus._Fields, TransferStatus> { + + @Override + protected TransferStatus._Fields getField(final String fieldName) { + return TransferStatus._Fields.valueOf(fieldName); + } + + @Override + protected TransferStatus newInstance() { + return new TransferStatus(); + } + + @Override + protected void validate(final TransferStatus instance) throws TException { + instance.validate(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/trstatus/TransferStatusSerializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/trstatus/TransferStatusSerializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/trstatus/TransferStatusSerializer.java new file mode 100644 index 0000000..074fbca --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/trstatus/TransferStatusSerializer.java @@ -0,0 +1,41 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.experiment.trstatus; + +import org.apache.airavata.model.workspace.experiment.TransferStatus; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TransferStatusSerializer extends + AbstractThriftSerializer<TransferStatus._Fields, TransferStatus> { + private final static Logger logger = LoggerFactory.getLogger(TransferStatusSerializer.class); + + @Override + protected TransferStatus._Fields[] getFieldValues() { + return TransferStatus._Fields.values(); + } + + @Override + protected Class<TransferStatus> getThriftClass() { + return null; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/ucdata/UserConfigurationDataDeserializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/ucdata/UserConfigurationDataDeserializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/ucdata/UserConfigurationDataDeserializer.java new file mode 100644 index 0000000..d4ff5ca --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/ucdata/UserConfigurationDataDeserializer.java @@ -0,0 +1,44 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.experiment.ucdata; + +import org.apache.airavata.model.workspace.experiment.UserConfigurationData; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftDeserializer; +import org.apache.thrift.TException; + +public class UserConfigurationDataDeserializer extends + AbstractThriftDeserializer<UserConfigurationData._Fields, UserConfigurationData> { + + @Override + protected UserConfigurationData._Fields getField(final String fieldName) { + return UserConfigurationData._Fields.valueOf(fieldName); + } + + @Override + protected UserConfigurationData newInstance() { + return new UserConfigurationData(); + } + + @Override + protected void validate(final UserConfigurationData instance) throws TException { + instance.validate(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/ucdata/UserConfigurationDataSerializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/ucdata/UserConfigurationDataSerializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/ucdata/UserConfigurationDataSerializer.java new file mode 100644 index 0000000..a537cf0 --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/ucdata/UserConfigurationDataSerializer.java @@ -0,0 +1,41 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.experiment.ucdata; + +import org.apache.airavata.model.workspace.experiment.UserConfigurationData; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class UserConfigurationDataSerializer extends + AbstractThriftSerializer<UserConfigurationData._Fields, UserConfigurationData> { + private final static Logger logger = LoggerFactory.getLogger(UserConfigurationDataSerializer.class); + + @Override + protected UserConfigurationData._Fields[] getFieldValues() { + return UserConfigurationData._Fields.values(); + } + + @Override + protected Class<UserConfigurationData> getThriftClass() { + return null; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validationrslt/ValidationResultsDeserializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validationrslt/ValidationResultsDeserializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validationrslt/ValidationResultsDeserializer.java new file mode 100644 index 0000000..a9ea19c --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validationrslt/ValidationResultsDeserializer.java @@ -0,0 +1,44 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.experiment.validationrslt; + +import org.apache.airavata.model.workspace.experiment.ValidationResults; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftDeserializer; +import org.apache.thrift.TException; + +public class ValidationResultsDeserializer extends + AbstractThriftDeserializer<ValidationResults._Fields, ValidationResults> { + + @Override + protected ValidationResults._Fields getField(final String fieldName) { + return ValidationResults._Fields.valueOf(fieldName); + } + + @Override + protected ValidationResults newInstance() { + return new ValidationResults(); + } + + @Override + protected void validate(final ValidationResults instance) throws TException { + instance.validate(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validationrslt/ValidationResultsSerializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validationrslt/ValidationResultsSerializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validationrslt/ValidationResultsSerializer.java new file mode 100644 index 0000000..95ad37f --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validationrslt/ValidationResultsSerializer.java @@ -0,0 +1,41 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.experiment.validationrslt; + +import org.apache.airavata.model.workspace.experiment.ValidationResults; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ValidationResultsSerializer extends + AbstractThriftSerializer<ValidationResults._Fields, ValidationResults> { + private final static Logger logger = LoggerFactory.getLogger(ValidationResultsSerializer.class); + + @Override + protected ValidationResults._Fields[] getFieldValues() { + return ValidationResults._Fields.values(); + } + + @Override + protected Class<ValidationResults> getThriftClass() { + return null; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validatorrslt/ValidatorResultDeserializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validatorrslt/ValidatorResultDeserializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validatorrslt/ValidatorResultDeserializer.java new file mode 100644 index 0000000..5b4a7a3 --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validatorrslt/ValidatorResultDeserializer.java @@ -0,0 +1,44 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.experiment.validatorrslt; + +import org.apache.airavata.model.error.ValidatorResult; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftDeserializer; +import org.apache.thrift.TException; + +public class ValidatorResultDeserializer extends + AbstractThriftDeserializer<ValidatorResult._Fields, ValidatorResult> { + + @Override + protected ValidatorResult._Fields getField(final String fieldName) { + return ValidatorResult._Fields.valueOf(fieldName); + } + + @Override + protected ValidatorResult newInstance() { + return new ValidatorResult(); + } + + @Override + protected void validate(final ValidatorResult instance) throws TException { + instance.validate(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validatorrslt/ValidatorResultSerializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validatorrslt/ValidatorResultSerializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validatorrslt/ValidatorResultSerializer.java new file mode 100644 index 0000000..a6ae64b --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/validatorrslt/ValidatorResultSerializer.java @@ -0,0 +1,41 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.experiment.validatorrslt; + +import org.apache.airavata.model.error.ValidatorResult; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ValidatorResultSerializer extends + AbstractThriftSerializer<ValidatorResult._Fields, ValidatorResult> { + private final static Logger logger = LoggerFactory.getLogger(ValidatorResultSerializer.class); + + @Override + protected ValidatorResult._Fields[] getFieldValues() { + return ValidatorResult._Fields.values(); + } + + @Override + protected Class<ValidatorResult> getThriftClass() { + return null; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfnd/WorkflowNodeDetailsDeserializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfnd/WorkflowNodeDetailsDeserializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfnd/WorkflowNodeDetailsDeserializer.java new file mode 100644 index 0000000..479e498 --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfnd/WorkflowNodeDetailsDeserializer.java @@ -0,0 +1,44 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.experiment.wfnd; + +import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftDeserializer; +import org.apache.thrift.TException; + +public class WorkflowNodeDetailsDeserializer extends + AbstractThriftDeserializer<WorkflowNodeDetails._Fields, WorkflowNodeDetails> { + + @Override + protected WorkflowNodeDetails._Fields getField(final String fieldName) { + return WorkflowNodeDetails._Fields.valueOf(fieldName); + } + + @Override + protected WorkflowNodeDetails newInstance() { + return new WorkflowNodeDetails(); + } + + @Override + protected void validate(final WorkflowNodeDetails instance) throws TException { + instance.validate(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfnd/WorkflowNodeDetailsSerializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfnd/WorkflowNodeDetailsSerializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfnd/WorkflowNodeDetailsSerializer.java new file mode 100644 index 0000000..1f26b68 --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfnd/WorkflowNodeDetailsSerializer.java @@ -0,0 +1,41 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.experiment.wfnd; + +import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class WorkflowNodeDetailsSerializer extends + AbstractThriftSerializer<WorkflowNodeDetails._Fields, WorkflowNodeDetails> { + private final static Logger logger = LoggerFactory.getLogger(WorkflowNodeDetailsSerializer.class); + + @Override + protected WorkflowNodeDetails._Fields[] getFieldValues() { + return WorkflowNodeDetails._Fields.values(); + } + + @Override + protected Class<WorkflowNodeDetails> getThriftClass() { + return null; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfns/WorkflowNodeStatusDeserializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfns/WorkflowNodeStatusDeserializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfns/WorkflowNodeStatusDeserializer.java new file mode 100644 index 0000000..62cad46 --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfns/WorkflowNodeStatusDeserializer.java @@ -0,0 +1,44 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.experiment.wfns; + +import org.apache.airavata.model.workspace.experiment.WorkflowNodeStatus; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftDeserializer; +import org.apache.thrift.TException; + +public class WorkflowNodeStatusDeserializer extends + AbstractThriftDeserializer<WorkflowNodeStatus._Fields, WorkflowNodeStatus> { + + @Override + protected WorkflowNodeStatus._Fields getField(final String fieldName) { + return WorkflowNodeStatus._Fields.valueOf(fieldName); + } + + @Override + protected WorkflowNodeStatus newInstance() { + return new WorkflowNodeStatus(); + } + + @Override + protected void validate(final WorkflowNodeStatus instance) throws TException { + instance.validate(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfns/WorkflowNodeStatusSerializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfns/WorkflowNodeStatusSerializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfns/WorkflowNodeStatusSerializer.java new file mode 100644 index 0000000..a33c8bb --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/experiment/wfns/WorkflowNodeStatusSerializer.java @@ -0,0 +1,41 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.experiment.wfns; + +import org.apache.airavata.model.workspace.experiment.WorkflowNodeStatus; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class WorkflowNodeStatusSerializer extends + AbstractThriftSerializer<WorkflowNodeStatus._Fields, WorkflowNodeStatus> { + private final static Logger logger = LoggerFactory.getLogger(WorkflowNodeStatusSerializer.class); + + @Override + protected WorkflowNodeStatus._Fields[] getFieldValues() { + return WorkflowNodeStatus._Fields.values(); + } + + @Override + protected Class<WorkflowNodeStatus> getThriftClass() { + return null; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/gateway/GatewayDeserializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/gateway/GatewayDeserializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/gateway/GatewayDeserializer.java new file mode 100644 index 0000000..6bc9361 --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/gateway/GatewayDeserializer.java @@ -0,0 +1,44 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.gateway; + +import org.apache.airavata.model.workspace.Gateway; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftDeserializer; +import org.apache.thrift.TException; + +public class GatewayDeserializer extends + AbstractThriftDeserializer<Gateway._Fields, Gateway> { + + @Override + protected Gateway._Fields getField(final String fieldName) { + return Gateway._Fields.valueOf(fieldName); + } + + @Override + protected Gateway newInstance() { + return new Gateway(); + } + + @Override + protected void validate(final Gateway instance) throws TException { + instance.validate(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/gateway/GatewaySerializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/gateway/GatewaySerializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/gateway/GatewaySerializer.java new file mode 100644 index 0000000..c0820ec --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/gateway/GatewaySerializer.java @@ -0,0 +1,41 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.gateway; + +import org.apache.airavata.model.workspace.Gateway; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class GatewaySerializer extends + AbstractThriftSerializer<Gateway._Fields, Gateway> { + private final static Logger logger = LoggerFactory.getLogger(GatewaySerializer.class); + + @Override + protected Gateway._Fields[] getFieldValues() { + return Gateway._Fields.values(); + } + + @Override + protected Class<Gateway> getThriftClass() { + return null; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/group/GroupDeserializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/group/GroupDeserializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/group/GroupDeserializer.java new file mode 100644 index 0000000..0bb640b --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/group/GroupDeserializer.java @@ -0,0 +1,44 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.group; + +import org.apache.airavata.model.workspace.Group; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftDeserializer; +import org.apache.thrift.TException; + +public class GroupDeserializer extends + AbstractThriftDeserializer<Group._Fields, Group> { + + @Override + protected Group._Fields getField(final String fieldName) { + return Group._Fields.valueOf(fieldName); + } + + @Override + protected Group newInstance() { + return new Group(); + } + + @Override + protected void validate(final Group instance) throws TException { + instance.validate(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/group/GroupSerializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/group/GroupSerializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/group/GroupSerializer.java new file mode 100644 index 0000000..d6f73a7 --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/group/GroupSerializer.java @@ -0,0 +1,41 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.group; + +import org.apache.airavata.model.workspace.Group; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class GroupSerializer extends + AbstractThriftSerializer<Group._Fields, Group> { + private final static Logger logger = LoggerFactory.getLogger(GroupSerializer.class); + + @Override + protected Group._Fields[] getFieldValues() { + return Group._Fields.values(); + } + + @Override + protected Class<Group> getThriftClass() { + return null; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/project/ProjectDeserializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/project/ProjectDeserializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/project/ProjectDeserializer.java new file mode 100644 index 0000000..2275748 --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/project/ProjectDeserializer.java @@ -0,0 +1,44 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.project; + +import org.apache.airavata.model.workspace.Project; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftDeserializer; +import org.apache.thrift.TException; + +public class ProjectDeserializer extends + AbstractThriftDeserializer<Project._Fields, Project> { + + @Override + protected Project._Fields getField(final String fieldName) { + return Project._Fields.valueOf(fieldName); + } + + @Override + protected Project newInstance() { + return new Project(); + } + + @Override + protected void validate(final Project instance) throws TException { + instance.validate(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/project/ProjectSerializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/project/ProjectSerializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/project/ProjectSerializer.java new file mode 100644 index 0000000..baefed0 --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/project/ProjectSerializer.java @@ -0,0 +1,40 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.project; + +import org.apache.airavata.model.workspace.Project; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ProjectSerializer extends AbstractThriftSerializer<Project._Fields, Project> { + private final static Logger logger = LoggerFactory.getLogger(ProjectSerializer.class); + + @Override + protected Project._Fields[] getFieldValues() { + return Project._Fields.values(); + } + + @Override + protected Class<Project> getThriftClass() { + return null; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/user/UserDeserializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/user/UserDeserializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/user/UserDeserializer.java new file mode 100644 index 0000000..d53e1d2 --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/user/UserDeserializer.java @@ -0,0 +1,44 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.user; + +import org.apache.airavata.model.workspace.User; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftDeserializer; +import org.apache.thrift.TException; + +public class UserDeserializer extends + AbstractThriftDeserializer<User._Fields, User> { + + @Override + protected User._Fields getField(final String fieldName) { + return User._Fields.valueOf(fieldName); + } + + @Override + protected User newInstance() { + return new User(); + } + + @Override + protected void validate(final User instance) throws TException { + instance.validate(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/user/UserSerializer.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/user/UserSerializer.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/user/UserSerializer.java new file mode 100644 index 0000000..aca4c31 --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/conversion/user/UserSerializer.java @@ -0,0 +1,40 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.conversion.user; + +import org.apache.airavata.model.workspace.User; +import org.apache.airavata.persistance.registry.mongo.conversion.AbstractThriftSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class UserSerializer extends AbstractThriftSerializer<User._Fields, User> { + private final static Logger logger = LoggerFactory.getLogger(UserSerializer.class); + + @Override + protected User._Fields[] getFieldValues() { + return User._Fields.values(); + } + + @Override + protected Class<User> getThriftClass() { + return null; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/dao/ExperimentDao.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/dao/ExperimentDao.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/dao/ExperimentDao.java new file mode 100644 index 0000000..5e7e43d --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/dao/ExperimentDao.java @@ -0,0 +1,378 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.dao; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.mongodb.*; +import com.mongodb.util.JSON; +import org.apache.airavata.model.workspace.experiment.Experiment; +import org.apache.airavata.model.workspace.experiment.TaskDetails; +import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails; +import org.apache.airavata.persistance.registry.mongo.conversion.ModelConversionHelper; +import org.apache.airavata.persistance.registry.mongo.utils.MongoUtil; +import org.apache.airavata.registry.cpi.RegistryException; +import org.apache.airavata.registry.cpi.ResultOrderType; +import org.apache.airavata.registry.cpi.utils.Constants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class ExperimentDao{ + private final static Logger logger = LoggerFactory.getLogger(ExperimentDao.class); + + private static final String EXPERIMENTS_COLLECTION_NAME = "experiments"; + private DBCollection collection; + private ModelConversionHelper modelConversionHelper; + + private static final String EXPERIMENT_ID = "experiment_id"; + private static final String EXPERIMENT_NAME= "name"; + private static final String EXPERIMENT_DESCRIPTION = "description"; + private static final String USER_NAME = "user_name"; + private static final String GATEWAY = "gateway_execution_id"; + private static final String APPLICATION_ID = "application_id"; + private static final String EXPERIMENT_STATUS_STATE = "experiment_status.experiment_state"; + private static final String CREATION_TIME = "creation_time"; + + //Todo Nested Indexes - Its good if we can get rid of them + private static final String WORKFLOW_NODE_ID = "workflow_node_details_list.node_instance_id"; + private static final String TASK_ID = "workflow_node_details_list.task_details_list.task_id"; + + + public ExperimentDao(){ + collection = MongoUtil.getAiravataRegistry().getCollection(EXPERIMENTS_COLLECTION_NAME); + modelConversionHelper = new ModelConversionHelper(); + collection.dropIndexes(); + initIndexes(); + } + + /** + * If indexes are already defined this will simply ignore them + */ + private void initIndexes(){ + collection.createIndex(new BasicDBObject(EXPERIMENT_ID, 1), new BasicDBObject("unique", true)); + collection.createIndex(new BasicDBObject(WORKFLOW_NODE_ID, 1)); + collection.createIndex(new BasicDBObject(TASK_ID, 1)); + +// //Defining a full-text index on experiment name and experiment description +// BasicDBObject object = new BasicDBObject(); +// object.put(EXPERIMENT_NAME, "text"); +// object.put(EXPERIMENT_DESCRIPTION, "text"); +// collection.createIndex (object); + } + + public List<Experiment> getAllExperiments() throws RegistryException{ + List<Experiment> experimentList = new ArrayList<Experiment>(); + DBCursor cursor = collection.find(); + for(DBObject document: cursor){ + try { + experimentList.add((Experiment) modelConversionHelper.deserializeObject( + Experiment.class, document.toString())); + } catch (IOException e) { + throw new RegistryException(e); + } + } + return experimentList; + } + + public void createExperiment(Experiment experiment) throws RegistryException{ + try { + WriteResult result = collection.insert((DBObject) JSON.parse( + modelConversionHelper.serializeObject(experiment))); + logger.debug("No of inserted results "+ result.getN()); + } catch (JsonProcessingException e) { + throw new RegistryException(e); + } + } + + /** + * The following operation replaces the document with item equal to + * the given experiment id. The newly replaced document will only + * contain the the _id field and the fields in the replacement document. + * @param experiment + * @throws RegistryException + */ + public void updateExperiment(Experiment experiment) throws RegistryException{ + try { + DBObject query = BasicDBObjectBuilder.start().add( + EXPERIMENT_ID, experiment.getExperimentId()).get(); + WriteResult result = collection.update(query, (DBObject) JSON.parse( + modelConversionHelper.serializeObject(experiment))); + logger.debug("No of updated results "+ result.getN()); + } catch (JsonProcessingException e) { + throw new RegistryException(e); + } + } + + public void deleteExperiment(Experiment experiment) throws RegistryException{ + DBObject query = BasicDBObjectBuilder.start().add( + EXPERIMENT_ID, experiment.getExperimentId()).get(); + WriteResult result = collection.remove(query); + logger.debug("No of removed experiments " + result.getN()); + } + + + public Experiment getExperiment(String experimentId) throws RegistryException{ + try { + DBObject criteria = new BasicDBObject(EXPERIMENT_ID, experimentId); + DBObject doc = collection.findOne(criteria); + if(doc != null){ + String json = doc.toString(); + return (Experiment)modelConversionHelper.deserializeObject( + Experiment.class, json); + } + } catch (IOException e) { + throw new RegistryException(e); + } + return null; + } + + public List<Experiment> searchExperiments(Map<String, String> filters, int limit, + int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException{ + List<Experiment> experimentList = new ArrayList<Experiment>(); + BasicDBObjectBuilder queryBuilder = BasicDBObjectBuilder.start(); + for (String field : filters.keySet()) { + if (field.equals(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_NAME)) { + queryBuilder.add(EXPERIMENT_NAME, new BasicDBObject( + "$regex", ".*" + filters.get(field) + ".*")); + } else if (field.equals(Constants.FieldConstants.ExperimentConstants.USER_NAME)) { + queryBuilder.add(USER_NAME, filters.get(field)); + } else if (field.equals(Constants.FieldConstants.ExperimentConstants.GATEWAY)) { + queryBuilder.add(GATEWAY, filters.get(field)); + } else if (field.equals(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_DESC)) { + queryBuilder.add(EXPERIMENT_DESCRIPTION, new BasicDBObject( + "$regex", ".*" + filters.get(field) + ".*")); + } else if (field.equals(Constants.FieldConstants.ExperimentConstants.APPLICATION_ID)) { + queryBuilder.add(APPLICATION_ID, filters.get(field)); + } else if (field.equals(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_STATUS)) { + queryBuilder.add(EXPERIMENT_STATUS_STATE, filters.get(field)); + } else if (field.equals(Constants.FieldConstants.ExperimentConstants.FROM_DATE)) { + queryBuilder.add(CREATION_TIME,new BasicDBObject("$gte",filters.get(field))); + } else if (field.equals(Constants.FieldConstants.ExperimentConstants.TO_DATE)) { + queryBuilder.add(CREATION_TIME,new BasicDBObject("$lte",filters.get(field))); + } + } + + //handling pagination and ordering. ordering is allowed only on CREATION_TIME + DBCursor cursor; + if(limit > 0 && offset >= 0) { + if(orderByIdentifier != null && orderByIdentifier.equals( + Constants.FieldConstants.ExperimentConstants.CREATION_TIME)){ + if(resultOrderType.equals(ResultOrderType.ASC)) { + cursor = collection.find(queryBuilder.get()).sort(new BasicDBObject(CREATION_TIME, 1)) + .skip(offset).limit(limit); + }else{ + cursor = collection.find(queryBuilder.get()).sort(new BasicDBObject(CREATION_TIME, -1)) + .skip(offset).limit(limit); + } + }else { + cursor = collection.find(queryBuilder.get()).skip(offset).limit(limit); + } + }else{ + if(resultOrderType != null && resultOrderType.equals( + Constants.FieldConstants.ExperimentConstants.CREATION_TIME)){ + if(resultOrderType.equals(ResultOrderType.ASC)) { + cursor = collection.find(queryBuilder.get()).sort(new BasicDBObject(CREATION_TIME, 1)); + }else{ + cursor = collection.find(queryBuilder.get()).sort(new BasicDBObject(CREATION_TIME, -1)); + } + }else { + cursor = collection.find(queryBuilder.get()); + } + } + for(DBObject document: cursor){ + try { + experimentList.add((Experiment) modelConversionHelper.deserializeObject( + Experiment.class, document.toString())); + } catch (IOException e) { + throw new RegistryException(e); + } + } + return experimentList; + } + + public void createWFNode(String experimentId, WorkflowNodeDetails workflowNodeDetail) throws RegistryException{ + Experiment experiment = getExperiment(experimentId); + experiment.getWorkflowNodeDetailsList().add(workflowNodeDetail); + updateExperiment(experiment); + } + + public void updateWFNode(WorkflowNodeDetails workflowNodeDetail) throws RegistryException{ + Experiment experiment = getParentExperimentOfWFNode(workflowNodeDetail.getNodeInstanceId()); + for(WorkflowNodeDetails wfnd: experiment.getWorkflowNodeDetailsList()){ + if(wfnd.getNodeInstanceId().equals(workflowNodeDetail.getNodeInstanceId())){ + experiment.getWorkflowNodeDetailsList().remove(wfnd); + experiment.getWorkflowNodeDetailsList().add(workflowNodeDetail); + updateExperiment(experiment); + return; + } + } + } + + public void deleteWFNode(WorkflowNodeDetails workflowNodeDetail) throws RegistryException{ + Experiment experiment = getParentExperimentOfWFNode(workflowNodeDetail.getNodeInstanceId()); + for(WorkflowNodeDetails wfnd: experiment.getWorkflowNodeDetailsList()){ + if(wfnd.getNodeInstanceId().equals(workflowNodeDetail.getNodeInstanceId())){ + experiment.getWorkflowNodeDetailsList().remove(wfnd); + updateExperiment(experiment); + return; + } + } + } + + public WorkflowNodeDetails getWFNode(String nodeId) throws RegistryException{ + Experiment experiment = getParentExperimentOfWFNode(nodeId); + if(experiment != null) { + for (WorkflowNodeDetails wfnd : experiment.getWorkflowNodeDetailsList()) { + if (wfnd.getNodeInstanceId().equals(nodeId)) { + return wfnd; + } + } + } + return null; + } + + public void createTaskDetail(String nodeId, TaskDetails taskDetail) throws RegistryException{ + Experiment experiment = getParentExperimentOfWFNode(nodeId); + for(WorkflowNodeDetails wfnd: experiment.getWorkflowNodeDetailsList()){ + if(wfnd.getNodeInstanceId().equals(nodeId)){ + wfnd.getTaskDetailsList().add(taskDetail); + updateExperiment(experiment); + return; + } + } + } + + public void updateTaskDetail(TaskDetails taskDetail) throws RegistryException{ + Experiment experiment = getParentExperimentOfTask(taskDetail.getTaskId()); + for(WorkflowNodeDetails wfnd: experiment.getWorkflowNodeDetailsList()){ + for(TaskDetails taskDetails: wfnd.getTaskDetailsList()){ + if(taskDetails.getTaskId().equals(taskDetail)){ + wfnd.getTaskDetailsList().remove(taskDetail); + wfnd.getTaskDetailsList().add(taskDetail); + updateExperiment(experiment); + return; + } + } + } + } + + public void deleteTaskDetail(TaskDetails taskDetail) throws RegistryException{ + Experiment experiment = getParentExperimentOfTask(taskDetail.getTaskId()); + for(WorkflowNodeDetails wfnd: experiment.getWorkflowNodeDetailsList()){ + for(TaskDetails taskDetails: wfnd.getTaskDetailsList()){ + if(taskDetails.getTaskId().equals(taskDetail)){ + wfnd.getTaskDetailsList().remove(taskDetail); + updateExperiment(experiment); + return; + } + } + } + } + + public TaskDetails getTaskDetail(String taskId) throws RegistryException{ + Experiment experiment = getParentExperimentOfTask(taskId); + if(experiment != null) { + for (WorkflowNodeDetails wfnd : experiment.getWorkflowNodeDetailsList()) { + for (TaskDetails taskDetails : wfnd.getTaskDetailsList()) { + if (taskDetails.getTaskId().equals(taskId)) { + return taskDetails; + } + } + } + } + return null; + } + + + /** + * Method to get parent Experiment of the given workflow node instance id + * @param nodeInstanceId + * @return + * @throws RegistryException + */ + public Experiment getParentExperimentOfWFNode(String nodeInstanceId) throws RegistryException{ + try { + DBObject criteria = new BasicDBObject(WORKFLOW_NODE_ID, nodeInstanceId); + DBObject doc = collection.findOne(criteria); + if(doc != null){ + String json = doc.toString(); + return (Experiment)modelConversionHelper.deserializeObject( + Experiment.class, json); + } + } catch (IOException e) { + throw new RegistryException(e); + } + return null; + } + + /** + * Method to get the parent experiment of the given task id + * @param taskId + * @return + * @throws RegistryException + */ + public Experiment getParentExperimentOfTask(String taskId) throws RegistryException{ + try { + DBObject criteria = new BasicDBObject(TASK_ID, taskId); + DBObject doc = collection.findOne(criteria); + if(doc != null){ + String json = doc.toString(); + return (Experiment)modelConversionHelper.deserializeObject( + Experiment.class, json); + } + } catch (IOException e) { + throw new RegistryException(e); + } + return null; + } + + /** + * Method to get the parent workflow node of the given task id + * @param taskId + * @return + * @throws RegistryException + */ + public WorkflowNodeDetails getParentWFNodeOfTask(String taskId) throws RegistryException{ + try { + DBObject criteria = new BasicDBObject(TASK_ID, taskId); + DBObject doc = collection.findOne(criteria); + if(doc != null){ + String json = doc.toString(); + Experiment experiment = (Experiment)modelConversionHelper.deserializeObject( + Experiment.class, json); + for(WorkflowNodeDetails wfnd: experiment.getWorkflowNodeDetailsList()){ + for(TaskDetails taskDetails: wfnd.getTaskDetailsList()){ + if(taskDetails.getTaskId().equals(taskId)){ + return wfnd; + } + } + } + } + } catch (IOException e) { + throw new RegistryException(e); + } + return null; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/801489bf/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/dao/GatewayDao.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/dao/GatewayDao.java b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/dao/GatewayDao.java new file mode 100644 index 0000000..ef66adb --- /dev/null +++ b/modules/registry/airavata-mongo-registry/src/main/java/org/apache/airavata/persistance/registry/mongo/dao/GatewayDao.java @@ -0,0 +1,179 @@ +/* + * + * 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. + * +*/ +package org.apache.airavata.persistance.registry.mongo.dao; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.mongodb.*; +import com.mongodb.util.JSON; +import org.apache.airavata.model.workspace.Gateway; +import org.apache.airavata.persistance.registry.mongo.conversion.ModelConversionHelper; +import org.apache.airavata.persistance.registry.mongo.utils.MongoUtil; +import org.apache.airavata.registry.cpi.RegistryException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class GatewayDao { + private final static Logger logger = LoggerFactory.getLogger(GatewayDao.class); + + private static final String GATEWAYS_COLLECTION_NAME = "gateways"; + private DBCollection collection; + private ModelConversionHelper modelConversionHelper; + + private static final String GATEWAY_ID = "gateway_id"; + private static final String GATEWAY_NAME = "gateway_name"; + private static final String DOMAIN = "domain"; + private static final String EMAIL_ADDRESS = "email_address"; + + public GatewayDao(){ + collection = MongoUtil.getAiravataRegistry().getCollection(GATEWAYS_COLLECTION_NAME); + modelConversionHelper = new ModelConversionHelper(); + collection.dropIndexes(); + initIndexes(); + } + + /** + * If indexes are already defined this will simply ignore them + */ + private void initIndexes(){ + collection.createIndex(new BasicDBObject(GATEWAY_ID, 1), new BasicDBObject("unique", true)); + collection.createIndex(new BasicDBObject(GATEWAY_NAME, 1), new BasicDBObject("unique", true)); + collection.createIndex(new BasicDBObject(EMAIL_ADDRESS, 1)); + collection.createIndex(new BasicDBObject(DOMAIN, 1)); + } + + public List<Gateway> getAllGateways() throws RegistryException{ + List<Gateway> gatewayList = new ArrayList(); + DBCursor cursor = collection.find(); + for(DBObject document: cursor){ + try { + gatewayList.add((Gateway) modelConversionHelper.deserializeObject( + Gateway.class, document.toString())); + } catch (IOException e) { + throw new RegistryException(e); + } + } + return gatewayList; + } + + public void createGateway(Gateway gateway) throws RegistryException{ + try { + WriteResult result = collection.insert((DBObject) JSON.parse( + modelConversionHelper.serializeObject(gateway))); + logger.debug("No of inserted results "+ result.getN()); + } catch (JsonProcessingException e) { + throw new RegistryException(e); + } + } + + /** + * The following operation replaces the document with item equal to + * the given gateway id. The newly replaced document will only + * contain the the _id field and the fields in the replacement document. + * @param gateway + * @throws org.apache.airavata.registry.cpi.RegistryException + */ + public void updateGateway(Gateway gateway) throws RegistryException{ + try { + DBObject query = BasicDBObjectBuilder.start().add( + GATEWAY_ID, gateway.getGatewayId()).get(); + WriteResult result = collection.update(query, (DBObject) JSON.parse( + modelConversionHelper.serializeObject(gateway))); + logger.debug("No of updated results "+ result.getN()); + } catch (JsonProcessingException e) { + throw new RegistryException(e); + } + } + + public void deleteGateway(Gateway gateway) throws RegistryException{ + DBObject query = BasicDBObjectBuilder.start().add( + GATEWAY_ID, gateway.getGatewayId()).get(); + WriteResult result = collection.remove(query); + logger.debug("No of removed experiments " + result.getN()); + } + + public Gateway getGateway(String gatewayId) throws RegistryException{ + try { + DBObject criteria = new BasicDBObject(GATEWAY_ID, gatewayId); + DBObject doc = collection.findOne(criteria); + if(doc != null){ + String json = doc.toString(); + return (Gateway)modelConversionHelper.deserializeObject( + Gateway.class, json); + } + } catch (IOException e) { + throw new RegistryException(e); + } + return null; + } + + public Gateway getGatewayByName(String gatewayName) throws RegistryException{ + try { + DBObject criteria = new BasicDBObject(GATEWAY_NAME, gatewayName); + DBObject doc = collection.findOne(criteria); + if(doc != null){ + String json = doc.toString(); + return (Gateway)modelConversionHelper.deserializeObject( + Gateway.class, json); + } + } catch (IOException e) { + throw new RegistryException(e); + } + return null; + } + + public List<Gateway> searchGateways(Map<String, String> filters, int limit, int offset) throws RegistryException{ + List<Gateway> gatewayList = new ArrayList(); + BasicDBObjectBuilder queryBuilder = BasicDBObjectBuilder.start(); + for (String field : filters.keySet()) { +// if (field.equals(Constants.FieldConstants.ProjectConstants.GATEWAY_NAME)){ +// fil.put(AbstractResource.ProjectConstants.GATEWAY_NAME, filters.get(field)); +// }else if (field.equals(Constants.FieldConstants.ProjectConstants.OWNER)){ +// fil.put(AbstractResource.ProjectConstants.USERNAME, filters.get(field)); +// }else if (field.equals(Constants.FieldConstants.ProjectConstants.DESCRIPTION)){ +// fil.put(AbstractResource.ProjectConstants.DESCRIPTION, filters.get(field)); +// }else if (field.equals(Constants.FieldConstants.ProjectConstants.GATEWAY_ID)){ +// fil.put(AbstractResource.ProjectConstants.GATEWAY_ID, filters.get(field)); +// } + } + + //handling pagination. + DBCursor cursor; + if(limit > 0 && offset >= 0) { + cursor = collection.find(queryBuilder.get()).skip(offset).limit(limit); + }else{ + cursor = collection.find(queryBuilder.get()); + } + for(DBObject document: cursor){ + try { + gatewayList.add((Gateway) modelConversionHelper.deserializeObject( + Gateway.class, document.toString())); + } catch (IOException e) { + throw new RegistryException(e); + } + } + return gatewayList; + } +} \ No newline at end of file
