Sorry, this is not the solution for my case.
Object Database doesn't have such a constructor.
Any help?



2014-02-20 9:36 GMT+01:00 Ena <[email protected]>:

> Found the answer this morning on this other thread:
> https://groups.google.com/forum/#!topic/orient-database/vvZcfIrWXWA
>
>
> 2014-02-19 18:04 GMT+01:00 Ena <[email protected]>:
>
> Hi all,
>> I'm an OrientDb newbie. I'm using the 2.0 snapshot. I'm writing a custom
>> command that will execute on an Object Database.
>> This command simply get a Person by name by an Object Database (Person
>> class is registered in the database and the schema is automatically
>> generated).
>>
>> I don't understand how to get my OObjectDatabaseTx from the execute
>> method.
>> The method getProfiledDatabaseInstance returns the underlying
>> ODocumentDatabaseTx.
>> Code is below, with the question part highlighted.
>>
>> Thanks!
>> Ena
>>
>> public class GetPersonCommand extends
>> OServerCommandAuthenticatedDbAbstract {
>>
>>  private final static Logger LOGGER = Logger.getLogger(GetPersonCommand
>> .class.getName());
>>
>> private static final String[] NAMES = { "GET|getPerson/*" };
>>
>> public GetPersonCommand(final OServerCommandConfiguration iConfiguration)
>> {
>>  super();
>> }
>>
>> @Override
>> public boolean execute(OHttpRequest iRequest, OHttpResponse iResponse)
>> throws Exception {
>>  LOGGER.log(Level.INFO, "GetPersonCommand, enter");
>>  // CHECK THE SYNTAX. 3 IS THE NUMBER OF MANDATORY PARAMETERS
>> String[] urlParts = checkSyntax(iRequest.url, 3, "Syntax error:
>> getPerson/<database>/<personName>");
>>
>> // TELLS TO THE SERVER WHAT I'M DOING (IT'S FOR THE PROFILER)
>>  iRequest.data.commandInfo = "getPerson";
>> iRequest.data.commandDetail = urlParts[2];
>>
>> // GET THE PARAMETERS
>> String name = urlParts[2];
>>
>> OObjectDatabaseTx db = null;
>> Person person = null;
>>  try {
>>                         // COMPILE ERROR! HOW TO GET IT?
>>  db = getProfiledDatabaseInstance(iRequest);
>>
>> List<Person> persons = db.query(new OSQLSynchQuery<Person>("select * from
>> Person where name = \"" + name
>>  + "\""));
>> if (persons.size() == 0) {
>>  iResponse.send(OHttpUtils.STATUS_NOTFOUND_CODE, "Not Found",
>> OHttpUtils.CONTENT_JSON, "Person with name '"
>>  + urlParts[2] + "' was not found.", null);
>> } else {
>>  person = persons.get(0);
>> iResponse.writeResult(person);
>>  }
>>
>> } catch (Exception e) {
>>  iResponse.send(OHttpUtils.STATUS_INTERNALERROR_CODE, "General Error",
>> OHttpUtils.CONTENT_JSON, "Error: "
>>  + e.getClass().getName(), null);
>> LOGGER.log(Level.WARNING, "Error", e);
>>  } finally {
>> if (db != null)
>>  db.close();
>> }
>>
>> return false;
>>
>>  }
>>
>> @Override
>>  public String[] getNames() {
>> return NAMES;
>>  }
>>
>> }
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "OrientDB" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/orient-database/rEwptEkMqIQ/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to