1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.common.request;
16 import org.simantics.db.ReadGraph;
17 import org.simantics.db.Resource;
18 import org.simantics.db.common.uri.UnescapedChildMapOfResource;
19 import org.simantics.db.exception.DatabaseException;
20 import org.simantics.db.request.ReadExt;
21 import org.simantics.db.request.RequestFlags;
23 final public class PossibleChild extends BinaryRead<Resource, String, Resource> implements ReadExt {
25 public PossibleChild(Resource resource, String name) {
26 super(resource, name);
30 public Resource perform(ReadGraph graph) throws DatabaseException {
31 Map<String, Resource> childMap = graph.syncRequest(new UnescapedChildMapOfResource(parameter));
32 return childMap.get(parameter2);
36 public String toString() {
37 return "PossibleChild " + parameter + " " + parameter2;
41 public boolean isImmutable(ReadGraph graph) throws DatabaseException {
42 return graph.isImmutable(parameter);
46 public int getType() {
47 return RequestFlags.IMMEDIATE_UPDATE;