public T unmarshal(Object object) throws Exception {
if (object == null) {
return null;
}
PersistenceWeavedRest persistenceWeavedRest = null;
Link link = null;
if (object instanceof PersistenceWeavedRest) {
persistenceWeavedRest = (PersistenceWeavedRest) object;
link = persistenceWeavedRest._persistence_getHref();
} else if (object instanceof Link) {
link = (Link) object;
} else {
return null;
}
if ((null == link) || ((link != null) && (link.getHref() == null))) {
if (persistenceWeavedRest != null) {
ClassDescriptor descriptor = context.getJAXBDescriptorForClass(persistenceWeavedRest.getClass());
if (persistenceWeavedRest instanceof FetchGroupTracker && JpaHelper.getDatabaseSession(context.getEmf()).doesObjectExist(persistenceWeavedRest)) {
if (context.doesExist(null, persistenceWeavedRest)) {
FetchGroup fetchGroup = new FetchGroup();
for (DatabaseMapping mapping : descriptor.getMappings()) {
if (!(mapping instanceof XMLInverseReferenceMapping)) {