All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bdware.doip.dbrepo.DBTableDO Maven / Gradle / Ivy

There is a newer version: 1.5.4
Show newest version
package org.bdware.doip.dbrepo;

import org.bdware.doip.codec.digitalObject.DigitalObject;
import org.bdware.doip.codec.digitalObject.DoType;
import org.bdware.doip.codec.doipMessage.DoipMessage;
import org.bdware.doip.codec.doipMessage.DoipMessageFactory;
import org.bdware.doip.codec.operations.BasicOperations;

public class DBTableDO extends DigitalObject {
    static DoipMessageFactory factory = new DoipMessageFactory();

    public DBTableDO(String id, DoType type) {
        super(id, type);
    }

    public static DBTableDO createDO(String url, String tableName, String userName, String password) {
        DBTableDO digitalObject = new DBTableDO(null, DoType.DO);
        digitalObject.addAttribute("url", url);
        digitalObject.addAttribute("tableName", tableName);
        digitalObject.addAttribute("userName", userName);
        digitalObject.addAttribute("password", password);
        return digitalObject;
    }

    public static DoipMessage retrieveMsg(String doid, int offset, int count) {
        DoipMessageFactory.DoipMessageBuilder builder = new DoipMessageFactory.DoipMessageBuilder();
        builder.createRequest(doid, BasicOperations.Retrieve.getName());
        builder.addAttributes("offset", offset);
        builder.addAttributes("count", count);
        return builder.create();
    }

    public static DoipMessage helloMsg(String doid) {
        DoipMessageFactory.DoipMessageBuilder builder = new DoipMessageFactory.DoipMessageBuilder();
        builder.createRequest(doid, BasicOperations.Hello.getName());
        return builder.create();
    }


    //update is not supported
    //delete is not supported

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy