本文整理了Java中pl.edu.icm.yadda.service2.YaddaObjectID
类的一些代码示例,展示了YaddaObjectID
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YaddaObjectID
类的具体详情如下:
包路径:pl.edu.icm.yadda.service2.YaddaObjectID
类名称:YaddaObjectID
暂无
代码示例来源:origin: pl.edu.icm.yadda/yadda-services2
public YaddaObjectMeta(String id, String version, String branch){
this.id=new YaddaObjectID(id,version,branch);
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-content
private String notNull(final YaddaObjectID id) {
if (id != null && id.getId() != null) {
return id.getId();
} else {
return "";
}
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-process
/**
* Checks whether two operations should be merged.
* @param sourceOp
* @param newOp
* @return true if two operations should be merged, false otherwise
*/
protected boolean shouldBeMerged(EditorOperation sourceOp, EditorOperation newOp) {
if (sourceOp instanceof TagOperation && newOp instanceof TagOperation) {
return ((TagOperation)sourceOp).getObject().equals(
((TagOperation)newOp).getObject());
}
return false;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-services2
/**
* Copy constructor
*
* @param id the id to copy
*/
public YaddaObjectID(YaddaObjectID id) {
this.id = id.getId();
this.branch = id.getBranch();
this.version = id.getVersion();
this.displayName = id.getDisplayName();
}
代码示例来源:origin: pl.edu.icm.yadda/recorddb-editor
@Override
protected DbObjectMeta findMetaNoPTs(YaddaObjectID oid) throws DataAccessException {
DbObjectMeta meta = jdbc.queryForObject(
"SELECT * FROM "+tablePrefix+METAS_TABLE_NAME+
" WHERE "+META_ID+"=? AND "+META_BRANCH+"=? AND "+META_VERSION+"=?"+
(history?"":" AND "+META_HISTORY+"="+sqlSelectBoolFalse),
metaRowMapper,
oid.getId(), oid.getBranch(), oid.getVersion()
);
meta.setTags(findTags(meta));
return meta;
}
代码示例来源:origin: pl.edu.icm.yadda/recorddb-editor
@Override
public List<CatalogObject<String>> produce(int limit) {
List<CatalogObject<String>> cos = new ArrayList<CatalogObject<String>>();
while (current < ids.length && limit > 0) {
YaddaObjectID oid = ids[current];
try {
CatalogObject<String> object =
oid.getVersion() == null ?
curdao.findObject(oid.getId(), request.getType()) :
curdao.findObject(oid, request.getType());
if (object != null) cos.add(object);
} catch (RuntimeException e) {
log.error("Exception caught", e);
throw e;
}
limit -= 1;
current += 1;
}
return cos;
}
@Override
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-process
@Override
protected Chunk doProcessChunk(Chunk data,
Map<String, Serializable> context,
IProcessListener processListener, ProcessingStats stats)
throws Exception {
for (WriteStatusRequest ce : data.getWriteStatusRequests()) {
String serializedElementStatus = xStream.toXML(ce.getNewStatus());
YaddaObjectID id = new YaddaObjectID(ce.getExtId().getId());
if (!data.getObjectsToWrite().containsKey(ce.getExtId().getId())) {
data.getObjectsToWrite().put(ce.getExtId().getId(), new CatalogObject<String>(id));
}
CatalogObjectPart<String> elementStatusPart = new CatalogObjectPart<String>(
CatalogParamConstants.TYPE_ELEMENT_PROCESSING_STATUS, serializedElementStatus);
data.getObjectsToWrite().get(ce.getExtId().getId()).addPart(elementStatusPart);
}
return data;
}
代码示例来源:origin: pl.edu.icm.yadda/recorddb-editor
if (oid.getVersion() != null) {
cur = catalogDao.findMeta(oid);
if (cur == null)
throw new VersionNotFoundException(oid);
} else
cur = catalogDao.findMeta(oid.getId());
log.warn("Dropping of parts requested, but no current object present in the catalog with id="+oid.getId());
oid.setBranch(newBranch());
oid.setVersion(START_VERSION);
log.warn("Tried to drop a part of "+co.getId().getId()+" with type "+type+", which does not exist.");
co.setId(new YaddaObjectID(cur.getId()));
YaddaObjectID caid = cur.getAlternativeId();
if (caid != null) co.setAlternativeId(new YaddaObjectID(caid));
co.setTimestamp(cur.getTimestamp());
} else if (isForeign(cur)) {
oid.setBranch(newBranch());
oid.setVersion(START_VERSION);
co.setAlternativeId(cur.getId());
} else {
oid = new YaddaObjectID(cur.getId());
oid.setVersion(nextVersion(oid.getVersion()));
co.setId(oid);
代码示例来源:origin: pl.edu.icm.yadda/yadda-services2
/**
* Returns true if the identifier relates to versioned object.
* It means the object is stored in catalog or storage and already
* owns a version number.
* @return
*/
public boolean isVersioned() {
return (getVersion() != null);
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-user
@Override
public UserProfile getUserProfile(String userId) {
try {
ArchiveObjectFacade archiveObject = archive.getObjectWithAllParts(new YaddaObjectID(userId), false);
if (archiveObject.getStatus().isDeleted()) {
return null;
}
UserProfile userProfile = new UserProfile();
userProfile.setUserId(archiveObject.getId().getId());
Collection<ArchiveContentPartFacade> archiveParts = archiveObject.getParts();
Set<String> parts = new HashSet<String>();
for (ArchiveContentPartFacade archivePart : archiveParts) {
parts.add(archivePart.getType());
}
userProfile.setAvailableParts(parts);
return userProfile;
} catch (NotFoundException e) {
// OK profile not found so part is null
return null;
} catch (ServiceException e) {
String message = "Fetching user profile for user " + userId + " not successfull.";
logger.error(message, e);
throw new RuntimeException(message, e);
}
}
代码示例来源:origin: pl.edu.icm.yadda/recorddb-editor
if (oid.getVersion() == null)
cur = catalogDao.findMeta(oid.getId());
else
cur = catalogDao.findMeta(oid);
oid = new YaddaObjectID(updated.getId());
oid.setVersion(START_VERSION);
oid.setBranch(newBranch());
updated.setId(oid);
} else {
updated.setAlternativeId(null);
oid.setVersion(nextVersion(oid.getVersion()));
updated.setId(oid);
代码示例来源:origin: pl.edu.icm.yadda/recorddb-editor
if (oid.getVersion() != null) {
cur = curdao.findMeta(oid);
if (cur == null)
throw new VersionNotFoundException(oid);
} else
cur = curdao.findMeta(oid.getId());
return save(co, new String[0], false, noSavingHistory);
} else
throw new ObjectNotFoundException(oid.getId());
代码示例来源:origin: pl.edu.icm.yadda/recorddb-editor
String aid = null, abr = null, avr = null;
if (aoid != null) {
aid = aoid.getId();
abr = aoid.getBranch();
avr = aoid.getVersion();
int i=0;
params[i++]=toDbBoolean(meta.isHistorical());
params[i++]=oid.getId(); params[i++]=oid.getBranch(); params[i++]=oid.getVersion();
params[i++]=aid; params[i++]=abr; params[i++]=avr;
params[i++]=meta.getTimestamp();
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
@Override
public YaddaObjectID nextId() {
return new YaddaObjectID(ancestorIdIterator.next());
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-services2
/**
* Returns an URI of the object
*
* @return
*/
public String encode() {
// TODO support versioning
String uri = URI_SCHEME + "://" + rootId.getId();
for (int i = 0; i < path.length; i++) {
uri = uri + "/" + path[i];
}
return uri;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-user
List<YaddaObjectID> ids = new ArrayList<YaddaObjectID>();
for (String name : rnames) {
ids.add(new YaddaObjectID(idMapper.getExtId(t,
name)));
if (SecurityObjectType.USER_PROFILE.equals(idMapper.getType(co.getId().getId()))) {
String objName = idMapper.getName(co.getId().getId());
UserProfile profile = new UserProfile(objName);
profile.setStruct(structSerializer.toObject(co.getPart(
o = profile;
} else {
o = serializer.toObject(co.getId().getId(), co.getPart(
partType).getData());
map.put(idMapper.getName(co.getId().getId()), o);
代码示例来源:origin: pl.edu.icm.yadda/recorddb-editor
@Override
public GetObjectResponse<String> getObject(GetObjectRequest request) {
GetObjectResponse<String> resp = new GetObjectResponse<String>();
try {
CatalogObject<String> co = null;
YaddaObjectID oid = request.getObject();
// we check history too if the request is for a specific version and metadata only
if (request.isOnlyMetadata()) {
CatalogObjectMeta meta;
if (oid.getVersion() == null)
meta = curdao.findMeta(oid.getId());
else
meta = histdao.findMeta(oid);
if (meta != null)
co = new CatalogObject<String>(meta);
} else {
if (oid.getVersion() == null)
co = curdao.findObject(oid.getId());
else
co = curdao.findObject(oid);
}
resp.setObject(co);
} catch (Exception e) {
log.error("Exception caught", e);
resp.setError(new YaddaError(ERROR_CODE, "exception caught", e));
}
return resp;
}
代码示例来源:origin: pl.edu.icm.yadda/recorddb-editor
String aid = null, abr = null, avr = null;
if (aoid != null) {
aid = aoid.getId();
abr = aoid.getBranch();
avr = aoid.getVersion();
params[i++]=oid.getId(); params[i++]=oid.getBranch(); params[i++]=oid.getVersion();
params[i++]=aid; params[i++]=abr; params[i++]=avr;
params[i++]=updated.getTimestamp();
代码示例来源:origin: pl.edu.icm.yadda/recorddb-editor
@Override
public CatalogObjectMeta update(DbObjectMeta current, CatalogObject<String> co) {
CatalogObjectMeta updated = co;
if (!current.getId().equals(co.getId()))
updated = update(current, (CatalogObjectMeta) co);
else
updateTags(current, co);
Set<String> present = new HashSet<String>(Arrays.asList(current.getPartTypes()));
for (CatalogObjectPart<String> pt : co.getParts()) {
if (present.contains(pt.getType()))
updatePart(current.getPK(), pt);
else {
savePart(current.getPK(), pt);
present.add(pt.getType());
}
}
updated.setPartTypes(present.toArray(new String[present.size()]));
return updated;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-user
@Override
public void removeUserProfile(String userId) {
try {
storage.deleteObject(new YaddaObjectID(userId));
} catch (NotFoundException e) {
// it is OK, profile not found so not removed
} catch (ServiceException e) {
String message = "Removing user profile for user " + userId + " not successfull.";
logger.error(message, e);
throw new RuntimeException(message, e);
}
}
内容来源于网络,如有侵权,请联系作者删除!